1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
using (SPSite spsite = new SPSite("http://")
{
using (SPWeb spweb = spsite.RootWeb)
{
SPList splist = spweb.Lists["library"];
SPListItemCollection elements = splist.Folders;
SPFolder folder = splist.RootFolder;
SPContentType docsetCT = splist.ContentTypes["Ensemble de documents"];
Hashtable properties = new Hashtable();
spweb.AllowUnsafeUpdates = true;
DocumentSet documentset = DocumentSet.Create(folder, Docset, docsetCT.Id, properties, true);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite spsite = VGST_MSITE)
{
using (SPWeb spweb = spsite.RootWeb)
{
SPGroupCollection groups = spweb.SiteGroups;
groups.Add(VVST_MARCHE, spweb.Author,null, "<Autorisations des agents SO>");
SPRoleAssignment assign = new SPRoleAssignment(groups[VVST_MARCHE]);
assign.RoleDefinitionBindings.Add(spweb.RoleDefinitions["lecture"]) ;
spweb.RoleAssignments.Add(assign) ;
spweb.Update();
}
}
});
}
} |
Partager