Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Set PageCreatedBy programmatically



I'm doing a custom import script that imports a number of pages by creating them programmatically, and I want to manually set the createdby username.

I have tried setting the property before saving and publishing, I have tried attaching to the various events, but no matter how I try it is allways changed to the username I'm currently logged in as.

Does anyone have a suggestion, or is this not possible?

Jun 16, 2015 16:34

You can always impersonate the user you want something like this could work:

PrincipalInfo.CurrentPrincipal = new GenericPrincipal(
		new GenericIdentity("the_user_you_want"), 
		new[] { "Administrators" }

Let me know how it goes...


Edited, Jun 16, 2015 16:37


Thanks, that's a good suggestion!

Jun 16, 2015 17:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.