Copy a SharePoint 2007 group along with its associated permissions

Posted by admin on August 04, 2012
C#, SharePoint, SharePoint-2007, SharePoint-API / No Comments

One of the challenges I’ve quite recently faced is how to copy a SharePoint 2007 role group whilst also retaining all of the permissions associated with that group (case example: One job title is splitting into two but both titles are going to hold the same SharePoint access).

SharePoint security group permissions are stored as role assignments on the SPWeb object. So, first we must find the group we want to copy by using:

Then we must use this retrieved group to get the roleassignments on the SPWeb object:

Then we must simply create a new SPGroup and add the group to the roleassignment and the roleassignment to the web object:

After this we should have a new group with the same permissions as the original group.

If you’re not doing the above in a SharePoint feature you can do it from a console application. Just create a console application in VS and fill it with something like this:

 

Who, what, where, when … why?

Posted by admin on July 22, 2012
Idle ramblings / No Comments

Welcome to my humble abode! I’m a SQL Server developer from Brisbane (clearly), Australia. I have little idea what I’m doing with this site – even less of an idea of what I want it to become. What I do know – this blog, for the meantime at least, is going to have very little flow. What do I mean by this? Essentially – I’m going to dump whatever I can here (code tutorials I’ve typed up to help me recall information, Brisbane going on’s and maybe even some information on a future project). In the future – who know’s! Maybe I’ll have something working on the main page that somebody other then myself will find interesting!