Finding out who published a page

Vote:
 

Hi,

I have created a workflow to handle accepting / rejecting pages. It works fine except for one small detail: I cannot find out who published the page.

The workflow is handling the onPagePublished event provided by EPiServer.WorkflowFoundation.Activities.OnPagePublish. The second argument (EPiServer.WorkflowFoundation.Activities.WorkflowPageEventArgs e) should have the Identity field set, but it is the empty string. For other events this seems to work. As a workaround I tried Membership.GetUser() to see who the current user is, but this returns null. I also tried loading the PageData, but while the user who created/changed the page is part of the data I don't see the publisher anywhere.

Thanks for any help.

#131572
Jul 30, 2015 10:47
Vote:
 

I would've guessed that user got put as ChangedBy. But maybe SetChangedOnPublish needs to be true.

Are you seeing the wanted username in the Admin Change Log Tool?

#131585
Edited, Jul 30, 2015 14:27
Vote:
 

Yes, in the Change Log Tool I see the correct username in the Publish action. Is there a way to access this information programmatically?

#131589
Jul 30, 2015 15:14
Vote:
 

If you are inside an event I'm unsure of the timing when the logging occurs but I would guess it's doable. Haven't tried or looked into it though. You could check using some reflector tool.

The change log is normally truncated regularly and can be disabled which needs consideration. You might want to keep investigating as the whole Change Log idea shouldn't be considered good practise :)

#131597
Jul 30, 2015 15:35
Vote:
 

Ok, thanks for your help. One more question though: I thought that 'SetChangedOnPublish' might be a good workaround, but I can't get it to work. On my base page type I overrode 'SetDefaultValues' and set SetChangedOnPublish = true.  When tracing with the debugger, it passes this point and executes the code. However, when the page is created and I examine it, this property is still false. Is there another step required?

#131622
Jul 31, 2015 10:45
Vote:
 

Not sure of the current state and which version you are running but it's always been a bit messy to work with the the "Mark as changed" feature from code. Maybe these links will help you:

http://dodavinkeln.se/post/how-to-set-a-page-updated-programmatically

http://world.episerver.com/blogs/Per-Nergard/Dates/2010/6/Mark-page-as-changed-checked-as-default/

http://world.episerver.com/documentation/Class-library/?documentId=cms/7.5/C5681A2F

#131624
Jul 31, 2015 11:15
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.