When assigning permissions to the BasePermissions property, you can use the following operators:
-
& - bitwise AND
-
^ - exclusive OR
-
| - inclusive OR
For Windows SharePoint Services permissions, you often work with each permission individually, so it is common to use ^ or | as operators.
The following three lines illustrate operator usage:
1) oRoleDefinition.BasePermissions |= SPBasePermissions.ManageSubwebs;
Retains the current permissions mask but adds ManageSubwebs to the mask.
2) oRoleDefinition.BasePermissions ^= SPBasePermissions.CreateSSCSite;
Retains the current permissions mask but removes CreateSSCSite from the mask.
3) oRoleDefinition.BasePermissions &= SPBasePermissions.CreateAlerts;
Reduces the permissions mask so that it only contains CreateAlerts.