Home > Forum > Plugins > HostingEnvironment.Impersonate() in version 2021

HostingEnvironment.Impersonate() in version 2021
0

Hello Everyone
I have to change sdk Custom Action class (not my code) from version 2019 to 2021. In old CustomAction was used HostingEnvironment.Impersonate() and I have also used this in 2021 version, but it generates error:

Method not found: 'WebCon.WorkFlow.SDK.Documents.Model.Base.ReadOnlyEntitiesCollection`1 WebCon.WorkFlow.SDK.Documents.Model.NewDocumentData.get_TextFields()'.
System.MissingMethodException

at WebCon.SRC.CustomActions.ADEmployeeSID.Run(RunCustomActionParams args)
at WebCon.WorkFlow.SDK.ActionPlugins.CustomAction`1.WebCon.WorkFlow.SDK.Interfaces.ActionPlugins.ICustomAction.Run(IRunCustomActionParams parms)
at WebCon.WorkFlow.Base.DataHelpers.SDK.SDKPluginLogger.ExecuteWithLogs(Action action, Boolean saveLogs, Func`1 isSucces)
at WebCon.WorkFlow.Base.Actions.PluginExecute.FireAction(InternalWorkFlowObject wfObject, IWFAction wfAction, ITagParser tagParser, String& message, String& logMessage)
at WebCon.WorkFlow.Base.Managers.Actions.ActionManager.FireActionWithUsageLog(IWFAction currentAction, String& message, String& logMessage, ActionBase action, InternalWorkFlowObject workflowObject, ITagParser tagParser)
at WebCon.WorkFlow.Base.Managers.Actions.ActionManager.FireSingleAction(InternalWorkFlowObject workFlowObject, String actionTypeName, Boolean canPathChange, Boolean checkInsertToPendingActions, FireActionsSummary fireActionsSummary, IWFAction action)
at WebCon.WorkFlow.Base.Managers.Actions.ActionManager.FireActions(IEnumerable`1 actionsToFire, InternalWorkFlowObject workFlowObject, String actionTypeName, Boolean canPathChange, Boolean checkInsertToPendingActions, FireActionsSummary fireActionsSummary, IActionMessageCreator actionMessageCreator)

Which method I should use instead ?
I have to do in this way because, I need to look up through Active Directory from code.
Thanks in advance for the hints!

Nobody has replied in this thread yet.