ShareBlog

Gary Bushey's Blog

Reading folder level security in MOSS (at least in a Document Library)

One nice new feature in MOSS is the ability to set folder level security...well I guess "nice" is a relative term.   In any case if you need to figure out what the security on a folder is you can use the following code (this assumes that "thisFolder" is a SPFolder that has already been set)

SPListItem thisItem = thisFolder.Item;      //Convert the SPFolder into an Item.  I think this only works in a document library.
SPBasePermissions thisItemsPermissions = thisItem.EffectiveBasePermissions;
//Check to see if a user can upload a document
if (thisItemsPermissions & SPBasePermissions.AddListItems) != SPBasePermissions.EmptyMask
{
   //Can upload
}

Posted: Aug 02 2007, 08:38 AM by gary | with 1 comment(s)
Filed under:

Comments

Adam Buenz said:

This is epic!

# August 2, 2007 4:38 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)