You can set permissions when you add roles. So updating role
permissions at site level is not necessary for the tasks here. But sometimes
developers need to change permission after a SharePoint site goes live and
roles have been created, so I added this method here for illustration purposes.
The permissions for SharePoint sub sites can be set at two
levels: site level and list level. The Permissions service provides methods for
working with the permissions for a site or list. The URL for this web service is
For example, if the sub site URL is http://testserver/sites/granttest/GRANTTEST2/default.aspx,
then the web service URL is http://testserver/sites/granttest/GRANTTEST2/
vti_bin/Permissions.asmx. No matter at which level the sub site resides, this
service is always available. This is different than some of the services that are
only available to the top level site.
The UpdatePermission method of the Permissions
service modifies site-level permissions for the specified site group, or
modifies permissions to the list for the specified user, site group, or
cross-site group. Its input parameters are defined as follows:
objectName A string that contains the name of the
list or site. It can be an empty string if it is a site.
objectType A string that specifies either List or
permissionIdentifier A string that contains the name
of the site group, the name of the cross-site group, or the user name
(DOMAIN\User_Alias) of the user to whom the permission applies.
permissionType A string that specifies user, group
(cross-site group), or role (site group). The user or cross-site group has to
be valid, and the site group has to already exist on the site.
permissionMask A 32-bit integer that specifies the
new permission mask (See table 1).
Listing 3 – Update permissions at site level
ws_Permissions.Permissions ws = newws_Permissions.Permissions();
NetworkCredential nc = newNetworkCredential(sUserName, sPassword, sDomain);
ws.Credentials = nc;
ws.Url = sOneSubSite +@"/_vti_bin/permissions.asmx";
int iMask = 0x00000400|0x00000800|0x00000100|0x00000002|0x00000004|0x00000008
ws.UpdatePermission("", "Web","Manager", "role", iMask);