Is it possible to set/override the value of CreatedBy when creating a new page programmatically?
I think you can just set it on the PageData object, but remember that all built in ("metadata") properties are prefixed with "Page" so the CreatedBy property is set through CurrentPage["PageCreatedBy"] = "myuser"; etc.
I just tried this Magnus, but the CreatedBy was still set to the logged in user.
Any other tip?
I thought it only was when the page was created in the UI, but apparently I was wrong :)I suppose you could try to listen to one of the datafactory events and change the property after the page is initially saved (fetch a specific version and save using the ForceCurrentVersion flag if you don't want to create an extra version, see the end of this blog post: http://blog.fredrikhaglund.se/blog/2009/02/18/work-with-unpublished-pagedata-from-code/ )
Thanks Magnus, I'll have a look at it and see if I can wrap my head around this...
I did as suggested:
1.Created and published the page
2. Opened the page again as a writable clone
3. Specified a new value for "PageCreatedBY"
4. Published the page with "ForceCurrentVersion" (which was very nice)
This did not help anything "CreatedBy" remained unchanged...
In the meantime I did a successful workaround on the issue that led me down this path, so I will let this one rest as it really was the least desirable solution.