How to get SubSites using client object model
Try this code to get list of all sub sites
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.Utilities; private static void GetAllSubSites() { ClientContext clientContext = new ClientContext(“http://{yoursiteurl}/“); Web oWebsite = clientContext.Web; clientContext.Load(oWebsite, website => website.Webs, website => website.Title ); clientContext.ExecuteQuery(); Console.WriteLine(“Available sites Count: ” + oWebsite.Webs.Count); for (int i = 0; i != oWebsite.Webs.Count; ) { Console.WriteLine(“Site Title: “+ oWebsite.Webs[i].Title); } }
My SharePoint Blog
http://dhireny.blogspot.com
댓글 없음:
댓글 쓰기