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: Thu, Aug 2 2007 8:38 by gary | with no comments
Filed under: