This code allows you to break the permissions inheritance of a site
string siteGroupNamePublisher = "SampleReadOnly";
string desc = "A group to manage read only user for root site";
siteCol = (SPSite)properties.Feature.Parent;
site = siteCol.RootWeb;
try {
SPSecurity.RunWithElevatedPrivileges(delegate() {
//Start--Creating SampleGroup which has read permissions n Break Inheritense
logFile.WriteInfo(CLASS, "FeatureActivated", "Creating SampleGroup which has read permissions n Break Inheritence", debugInfo);
SPGroup secGroup1;
SPRoleAssignment roleAssignment1;
SPRoleDefinition roleDefinition1;
site.SiteGroups.Add(siteGroupNamePublisher, site.CurrentUser, site.CurrentUser, desc);
secGroup1 = site.SiteGroups[siteGroupNamePublisher];
roleAssignment1 = new SPRoleAssignment(secGroup1);
roleDefinition1 = site.RoleDefinitions["Read"]; roleAssignment1.RoleDefinitionBindings.Add(roleDefinition1); site.RoleAssignments.Add(roleAssignment1);
//End--Creating SampleGroup which has read permissions n Break Inheritense
});
Friday, August 29, 2008
Update() Vs SystemUpdate()
Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().
What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem ?
ListItem.Update() will....
Creates new version automatically for each and every update
Updates the Modifer field details with SystemAccount
ListItem.SystemUpdate()
Don't create new version for updates
Updates the Modifer field details with the user details who updates the ListItem
What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem ?
ListItem.Update() will....
Creates new version automatically for each and every update
Updates the Modifer field details with SystemAccount
ListItem.SystemUpdate()
Don't create new version for updates
Updates the Modifer field details with the user details who updates the ListItem
Subscribe to:
Posts (Atom)