Skip to content

Instantly share code, notes, and snippets.

@trnktms

trnktms/WithVirtualUser.cs

Last active Jan 24, 2019
Embed
What would you like to do?
var virtualUser = AuthenticationManager.BuildVirtualUser("sitecore\\myProcessorUser", false);
virtualUser.RuntimeSettings.IsAdministrator = true;
virtualUser.RuntimeSettings.Save();
using (new UserSwitcher(virtualUser))
{
WorkflowUtility.ExecuteWorkflowCommandIfAvailable(item, commandItem, commentFields);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.