Using the Umbraco API, how do you get a reference to the User object of the person who last updated (or published) a page? I want to use this to get the email address of that person.
I thought this would be simple, but it doesn't appear to be! What I've found is that:
umbraco.presentation.nodeFactory.Node has a property called "WriterName" which is a string. However, this is the full name of the person and not the username or id, so cannot be used to instantiate a new umbraco.BusinessLogic.User object from it.
The umbraco.cms.businesslogic.web.Document class exposes a User property, but this is always the original creator of the document, and not the person who last edited it. There doesn't seem to be any property for last publisher.
The umbraco.BusinessLogic.User class has methods to instantiate a new User, but only based on either their userId or login-name (neither of which are exposed by the Node class).
I feel like there must surely be a way to get this, but can't see how? Anyone?
OK, I've found even more bizzare behaviour when using the Document class:
When you do this you get a reference to the creator:
[code]
Document doc = new Document(1148);
string username = doc.User.LoginName;
[/code]
When you do this (passing in the "optimized mode" flag) you get a reference to the last updater:
[code]
Document doc = new Document(true, 1148);
string username = doc.User.LoginName;
[/code]
Surely this is bizzare behaviour? Why would "optimised mode" give you a different User for the creator property? Is this a bug or intentional?
Getting the user who last updated a page. How?
Using the Umbraco API, how do you get a reference to the User object of the person who last updated (or published) a page? I want to use this to get the email address of that person.
I thought this would be simple, but it doesn't appear to be! What I've found is that:
umbraco.presentation.nodeFactory.Node has a property called "WriterName" which is a string. However, this is the full name of the person and not the username or id, so cannot be used to instantiate a new umbraco.BusinessLogic.User object from it.
The umbraco.cms.businesslogic.web.Document class exposes a User property, but this is always the original creator of the document, and not the person who last edited it. There doesn't seem to be any property for last publisher.
The umbraco.BusinessLogic.User class has methods to instantiate a new User, but only based on either their userId or login-name (neither of which are exposed by the Node class).
I feel like there must surely be a way to get this, but can't see how? Anyone?
OK, I've found even more bizzare behaviour when using the Document class:
When you do this you get a reference to the creator:
[code]
Document doc = new Document(1148);
string username = doc.User.LoginName;
[/code]
When you do this (passing in the "optimized mode" flag) you get a reference to the last updater:
[code]
Document doc = new Document(true, 1148);
string username = doc.User.LoginName;
[/code]
Surely this is bizzare behaviour? Why would "optimised mode" give you a different User for the creator property? Is this a bug or intentional?
Dan, did you ever get to the bottom of this?
is working on a reply...