Environment: SP2010 Enterprise, VS2012, c# Server-Side, full control of environment
I'm trying to assign unique permissions to an
SPItem (a folder in a document library) through a console app on the server. I've been reading up on how to break inheritance and assign permissions on this blog and combing through msdn articles like this one. I have a specific custom role,
CustomContribute, that I want to assign to certain folders programmatically, but none of the guides I've found tell how to do anything beyond the OOB roles (Contribute, Delete, Read, etc). A few places like this one explain how to create a custom permission level, but I need a little help making the leap from that to actually assigning it to things.
Am I on the right track, or barking up the wrong tree? Any advice or links would be appreciated!
SPFolder.Item property is probably what I'm looking for to add the role definition but I'm having issues specifying the folder in such a way that the property will fetch the item. See the code below for an example.
SPFolder oFolder = oWeb.GetFolder(folderPath); SPListItem oItem = oFolder.Item; // Here it throws an exception, "The object specified does not belong to a list."
Is there a better way to select the folder based on the list itself, rather than through the