Using SharePoint Web Services to Change Subsite Permissions
page 2 of 5
by Grant Zhang
Feedback
Average Rating: 
Views (Total / Last 10 Days): 64540/ 98

Working with a Collection of Sub Sites

Microsoft has provided SharePoint Web services to work with sites and sub sites. The URL for this site is: http://Server_Name/[sites/][Site_Name/]_vti_bin/Webs.asmx.

It provides five methods. The GetAllSubWebCollection method returns the titles and URLs of all sites within the current site collection. Here we use GetWebCollection() to get the titles and URLs of all sites directly beneath the current site. Listing 1 shows the code to return all the sub sites one level down.

Listing 1 – Get all the sub sites directly beneath the current site

ws_webs.Webs ws = new ws_webs.Webs();
ws.Url = sSPSServer + @"/" +sSecondLevelSite + "/_vti_bin/Webs.asmx";
ws.Credentials =System.Net.CredentialCache.DefaultCredentials;
System.Xml.XmlNode nd = ws.GetWebCollection();
XmlNodeList ndlist = nd.ChildNodes;
foreach (XmlNode xGet in ndlist)
{
  string sWebTitle = xGet.Attributes["Title"].Value;
  string sOneSubSite =xGet.Attributes["Url"].Value;
}

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-2019 ASPAlliance.com  |  Page Processed at 2019-12-11 7:41:19 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search