volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Set CreatedBy Progammatically

Hi all.

Is it possible to set/override the value of CreatedBy when creating a new page programmatically?

Petter

#60703
Aug 22, 2012 8:29

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.

#60715
Aug 22, 2012 8:55

I just tried this Magnus, but the CreatedBy was still set to the logged in user.

Any other tip?

Petter

#60716
Aug 22, 2012 9:11

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/ )

#60720
Aug 22, 2012 10:53

Thanks Magnus, I'll have a look at it and see if I can wrap my head around this...

Petter

#60723
Aug 22, 2012 11:43

Hi Magnus.

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.

Thanks

Petter

#60743
Aug 23, 2012 7:06
error This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.