Using SharePoint Web Services to Change Subsite Permissions
page 1 of 5
Published: 23 Mar 2006
Unedited - Community Contributed
Abstract
In this article, Grant examines how to retrieve all the sub sites, add roles, add users, add and change permissions at the site and list levels using Sharepoint web services.
by Grant Zhang
Feedback
Average Rating: 
Views (Total / Last 10 Days): 41626/ 62

Introduction

A SharePoint site and its contents can not only be created and updated manually, but also programmatically. Microsoft has provided SharePoint class libraries and web services for this purpose. I was involved in programmatically creating SharePoint sites, adding and updating web parts, setting permissions, changing lists etc., basically working with every aspect of SharePoint sub sites. I found generally if anything can be done manually, it can also be done programmatically. In this article, I'd like to introduce how to use SharePoint web services to loop through all the sub sites to add roles, add users to site roles, and update role permissions on site and list levels.

In the attached example program, I’ll accomplish the following tasks:

·         Work with many sub sites under a top level site;

·         Add a Manager role and add a user “us\grant” to this role in every sub site;

·         Customize the permissions of the Manager role in every sub site;

·         Customize the permissions of the Manager role to the "Shared Document" library for every sub site.

The sample program will work only if you update the web services with the valid URL and change the network credentials to the correct user name and password.

System Requirements

The server has to be Microsoft Office SharePoint Portal Server 2003. The development system can be any Windows system with Microsoft Visual Studio .NET 2003 installed. When calling the web services, the network credential passed in must have the corresponding permissions on the site.


View Entire Article

User Comments

Title: SoapServerException   
Name: Raj
Date: 2009-05-26 2:28:10 AM
Comment:
good artical
Title: SoapServerException   
Name: Grant Zhang
Date: 2008-11-06 8:59:26 AM
Comment:
\
\
Title: SoapServerException   
Name: Srinivas Reddy
Date: 2008-11-06 7:23:25 AM
Comment:
\
Title: Reply to Get a Exception on AddRole   
Name: Grant Zhang
Date: 2007-09-05 9:15:04 AM
Comment:
Check details in SoapException and you'll find teh real reason why it failed.
Title: Get a Exception on AddRole   
Name: Dinesh Chaudhari
Date: 2007-09-05 8:54:07 AM
Comment:
Hello ,
This article is very nice to learn SP webservices. I tired the sample with making necessary changes .But i got following Exception :So can you tell me where I go wrong or is there any setting i need to do for removing this exception .I am waiting for reply:
My Conatact Email id: dinchaudhari@gmail.com

Role Manager can not be added to the site: http://ps2454:41300/1100. The error: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

The permissions can not be updated for http://ps2454:41300/1100. The error: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

The permissions can not be updated for http://ps2454:41300/1100. The error: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
Title: Using SharePoint Web Services to Change Subsite Permissions   
Name: nak
Date: 2007-06-14 7:24:44 AM
Comment:
good article.
I like it
Title: This Approach is not for MOSS 7   
Name: Sourabh
Date: 2007-06-08 11:14:53 AM
Comment:
Hi all this is not a supported modal for MOSS 7 or sharepoint 2007 instead use the roledefinition as the permission is depricated.
Title: Good Article   
Name: Prasant
Date: 2007-05-23 7:28:18 AM
Comment:
Thanks.. It is working. I was using "AddUserToGroup"..

Thanks again
Title: Good Article   
Name: Prasant
Date: 2007-05-23 7:24:11 AM
Comment:
I have one question:
I am trying to add user to "Contributor" Site group.but it gives error that "Cross-site group cannot be found".

How we can add user to built-in site groups.

Thanks
Title: Excellent Article   
Name: Anil
Date: 2006-12-27 9:43:40 AM
Comment:
Excellent article,this helped me a lot in getting started with Sharepoint web services.Example is too.. good.
Title: Very useful article   
Name: Anupam
Date: 2006-04-05 7:43:36 AM
Comment:
Helped a lots in getting us started with Sharepoint web services.
Title: Useful but   
Name: Anvar
Date: 2006-04-04 3:38:29 AM
Comment:
HI this is a useful and great article.
Will you please give what are parametrs are there in network credential information. Even i am having administrator power i t is not allowing me to get in. please help me.
Title: Great Article   
Name: Niels Hansen
Date: 2006-03-25 8:27:26 PM
Comment:
Great Article. This is exactly the information I was looking for. Please do more on how to progamatically use SPS.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 10:01:26 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search