Blog Home  Home RSS 2.0 Atom 1.0 CDF  
Pedro Serrano - Document Library item's author is current user?
Blog 'till you drop
 
 Sunday, December 02, 2007

If you ever want to check if a document library item's author is the current user, here's the code snippet on how to do it:

SPFieldUserValue authorUserValue = new SPFieldUserValue(myWeb, myItem["Author"].ToString());
if (myWeb.CurrentUser.LoginName == authorUserValue.User.LoginName)
{

// your code will go here
}

Hope this takes away pain from anyone trying to use GetByID ;-)

P.S.: sorry all of you I haven't yet replied to your emails - I've been on the road and jumping airports a lot, so life is kinda hectic which is making it hard to keep up with my mailbox.

12/2/2007 2:30:56 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]   .NET | SharePoint  |  Trackback
Tracked by:
"Document Library item's author is current user?" (SHAREPOINTBlogs.com Mirror) [Trackback]
Comments are closed.
Copyright © 2008 Pedro Serrano. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: