I want to do the same. Is there a solution already???
And in my opinion the question is not only an UIPath-related topic:
There is a class which allows to Enter/Leave a specified user context over WindowsIdentity with a token generated by the unmanaged function LogonUser(...) from advapi32.dll.
In the custom activity i enter the user context in ExecuteAsync(...) and leave it in Cleanup(...) expecting the code contained in ExecuteAsync(...) is executed before Cleanup(...).
But it seems that Cleanup(...) is executed before the ExecuteAsync-Method.
What can make the trick to execute code in the order i expect it to work?
Can I simply use Execute-Method instead of ExecuteAsync?