Getting the last user who updated the document Options
seb
Posted: Thursday, March 06, 2008 3:11:40 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 61
Location: London
Hi all,

I'm writing a small tool that will run as a scheduled task to alert users when pages hasn't been updated for more than x months.

In the Document class, there is a UserID property that seems to be the creator ID, not the last user who has updated the document. Also this information should be available as it is stored somewhere (at least in the umbraco.config file, there is a writerID for each node which seems to be the last "updator" ID).

Does anybody knows how to retrieve this information?

many thanks,

seb





http://www.be-k.net
stephan@tewonder.se
Posted: Thursday, March 06, 2008 3:40:43 PM

Rank: Devotee

Joined: 11/9/2006
Posts: 47
Location: Stockholm
I think what u r looking for is the writerID, that should point to last user to publish the document.
seb
Posted: Thursday, March 06, 2008 3:55:57 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 61
Location: London
it is yes, but unfortunaly WriterID is not a property of the Document class. So how do I get it? Remember i'm not within XSLT, I'm in some C# code.


cheers,
seb

http://www.be-k.net
stephan@tewonder.se
Posted: Thursday, March 06, 2008 4:03:23 PM

Rank: Devotee

Joined: 11/9/2006
Posts: 47
Location: Stockholm
Ugly hack warning!

Use the library to get the XmlPathNodeIterator from umbraco.library.GetXmlNodeById(Document.Id), and grab the writerID attribute from there.

:)

Have fun!

//S
seb
Posted: Thursday, March 06, 2008 4:28:40 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 61
Location: London
:)

yeah I actually tried that first; it didn't work. The reason for that was because the application I'm building will sit outside umbraco web folder, and therefore will not have access to the umbraco.config file. I can't see another way but using this Document class.
please correct me if I'm wrong


seb

http://www.be-k.net
stephan@tewonder.se
Posted: Thursday, March 06, 2008 4:33:43 PM

Rank: Devotee

Joined: 11/9/2006
Posts: 47
Location: Stockholm
Are you trying to access umbraco from outside the web site? In that case I'd say a web service would be your best bet. If you are building a stand-alone app, it's either this or some other API you need.

Good luck!

//S
seb
Posted: Thursday, March 06, 2008 5:13:18 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 61
Location: London
it's more than I'm trying to access the site data using umbraco API to do some stuff (sending an email to user who haven't updated their content recently enough).

At the end, I will get an exe that will be run daily on the server. So I'm not in the context of a web app here, but really as a stand-alone application using some API, umbraco being one of them.

I would say the writerID has been forgotten from the Document class; will report that on Codeplex. But in the mean time, I'm a bit stucked here :(



http://www.be-k.net
seb
Posted: Thursday, March 06, 2008 6:01:26 PM

Rank: Devotee

Joined: 1/10/2008
Posts: 61
Location: London
right, after more readings on the forum, I think I should rather create a page that runs my code and use the build-in Umbraco scheduler.

This way I'll be able to use the GetXml.. functions. Also I wanted to extend notifications
so users can have a similar email to the current notifications ones when the content they are responsible for needs to be reviewed, and found out that Actions need to be run in a web context.

thanks,
seb

http://www.be-k.net
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.