Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:57:54+00:00 2026-06-11T09:57:54+00:00

I want to Create a Windows Application that Display : all Web Application, Sites

  • 0

I want to Create a Windows Application that

Display :

  • all Web Application,

  • Sites Collection of Each web Applications,

  • Sites of Each Site Collection,

  • Sub-Sites of Each Sites,

  • All lists-Libraries of Each Site and Sub-Sites in Tree-view

here i don’t want to Give any Static URL, on Application Start up That All Information Filled Automatically in Tree-view if SharePoint is Installed on that Computer.

Is this Possible ? if yes then how ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:57:55+00:00Added an answer on June 11, 2026 at 9:57 am

    .Net Managed Client Object Model: Fetch All Webs, Libraries, Items

    In SharePoint 2010, we have 3 client object model.

    1. .Net Managed Client Object Model
    2. Silverlight
    3. ECMA Script / JavaScript

    Today, I am presenting .NET Managed Client Object Model to retrieve all webs, libraries, items from SharePoint.

    Prerequisites References for your desktop application:

    1. Microsoft.SharePoint.Client.dll
    2. Microsoft.SharePoint.Client.Runtime.dll

    My Custom Classes to feel like we are working on SharePoint Server Object model:

    public class SPWeb
     {
         public string WebGUID { get; set; }
         public string Title { get; set; }
         public string ServerRelativeUrl { get; set; }
         public string ParentType { get; set; }
         public SPBase Parent { get; set; }
     }
     public class SPList
     {
         public string ListGUID { get; set; }
         public string Title { get; set; }
         public string ParentWebUrl { get; set; }
         public string RootFolderServerRelativeUrl { get; set; }
     }
    
    public class SPFolder
     {
         public string ID { get; set; }
         public string UniqueID { get; set; }
         public string Name { get; set; }
         public string Title { get; set; }
         public string ParentWebUrl { get; set; }
         public string ListName { get; set; }
         public string ServerRelativeUrl { get; set; }
         public string ParentFolderServerRelativeUrl { get; set; }
     }
    
     public class SPListItem
     {
         public string ID { get; set; }
         public string Name { get; set; }
         public string Title { get; set; }
         public string ServerRelativeUrl { get; set; }
         public string Modified { get; set; }
         public string ModifiedBy { get; set; }
         public string CreatedBy { get; set; }
         public string Size { get; set; }
         public string Created { get; set; }
         public string UniqueId { get; set; }
         public string ListName { get; set; }
     }
    

    Methods which is used to fetch Webs / libraries / Items:

    public List<SPWeb> GetAllWebs(string webURL)
    {
        var webColl = new List<SPWeb>();
        try
        {
        var currentWeb = _ctx.Site.OpenWeb(webURL);
        var allWebs = currentWeb.Webs;
        var webCollection = _ctx.LoadQuery(allWebs.Include(web => web.Title,
        web => web.Id, web => web.ServerRelativeUrl));
        _ctx.ExecuteQuery();
        webColl.AddRange(webCollection.Select(web => new SPWeb
                                    {
                                      Title = web.Title,
                                      WebGUID = web.Id.ToString(),
                                      ServerRelativeUrl = web.ServerRelativeUrl
                                     }));
        }
        catch (Exception ex)
        {
          // error log
        }
     return webColl;
    }
    
    public List<SPList> GetAllLibraries(string webURL)
    {
       var listColl = new List<SPList>();
       try
       {
         var currentWeb = _ctx.Site.OpenWeb(webURL);
         var query = from list in currentWeb.Lists
                     where list.BaseType == BaseType.DocumentLibrary
                     select list;
         var AllLists = currentWeb.Lists;
         var listCollection = _ctx.LoadQuery(query.Include(myList => myList.Title,
                                       myList => myList.Id,
                                       myList => myList.RootFolder.ServerRelativeUrl,
                                       myList => myList.ParentWebUrl,
                                       myList => myList.Hidden,
                                       myList => myList.IsApplicationList));
      _ctx.ExecuteQuery();
    
      listColl.AddRange(from list in listCollection
                        where !list.Hidden
                        select new SPList
                        {
                            Title = list.Title,
                            ListGUID = list.Id.ToString(),
                            RootFolderServerRelativeUrl = list.RootFolder.ServerRelativeUrl,
                            ParentWebUrl = list.ParentWebUrl
                         });
       }
       catch (Exception ex)
       {
           // error log
       }
      return listColl;
    }
    
    public List<SPFolder> GetAllFolder(string webURL, string listName, string folderName)
    {
        var itemColl = new List<SPFolder>();
        try
        {
          var currentWeb = _ctx.Site.OpenWeb(webURL);
          var currentList = currentWeb.Lists.GetByTitle(listName);
    
          var query = new CamlQuery();
    
          if (folderName.Length > 0)
             query.FolderServerRelativeUrl = folderName;
    
          query.ViewXml = @"<View><Query><Where>
                            <Or>
                              <Eq>
                                 <FieldRef Name='ContentType' />
                                 <Value Type='Text'>Document Set</Value>
                              </Eq>
                              <Eq>
                                 <FieldRef Name='ContentType' />
                                 <Value Type='Text'>Folder</Value>
                              </Eq>
                            </Or>
                            </Where></Query></View>";
    
          var listitems = currentList.GetItems(query);
      _ctx.Load(listitems);
      _ctx.ExecuteQuery();
    
      itemColl.AddRange(listitems.ToList().Select(item => new SPFolder()
                       {
                           ID = Convert.ToString(item["ID"]),
                           UniqueID = Convert.ToString(item["GUID"]),
                           ListName = listName,
                           ParentWebUrl = webURL,
                           Title = Convert.ToString(item["FileLeafRef"]),
                           Name = "folder",
                           ServerRelativeUrl = Convert.ToString(item["FileRef"])
                       }).AsEnumerable());
      }
      catch (Exception ex)
      {
         // error log
      }
      return itemColl;
    }
    public List<SPListItem> GetAllItems(string webURL, string listName, string folderName)
    {
        var itemColl = new List<SPListItem>();
        try
        {
            var currentWeb = _ctx.Site.OpenWeb(webURL);
            var currentList = currentWeb.Lists.GetByTitle(listName);
            var query = new CamlQuery();
    
            if (folderName.Length > 0)
               query.FolderServerRelativeUrl = folderName;
    
            var myquery = from myitems in currentList.GetItems(query)
                          select myitems;
    
            var listitems = _ctx.LoadQuery(myquery.Include(myitem => myitem["ID"],
                                          myitem => myitem["FileLeafRef"],
                                          myitem => myitem["Modified"],
                                          myitem => myitem["File_x0020_Size"],
                                          myitem => myitem["Modified_x0020_By"],
                                          myitem => myitem["Created_x0020_By"],
                                          myitem => myitem["FileRef"],
                                          myitem => myitem["UniqueId"],
                                          ));
    
             _ctx.ExecuteQuery();
    
             foreach (var nitem in listitems.Select(item => new SPListItem
             {
                   ID = Convert.ToString(item["ID"]),
                   ParentWebUrl = webURL,
                   Title = Convert.ToString(item["FileLeafRef"]),
                   Modified = item["Modified"] != null ?         Convert.ToString(item["Modified"]) : string.Empty, Size = item["File_x0020_Size"] != null ? Convert.ToString(item["File_x0020_Size"]) : string.Empty,
               CreatedBy = item["Created_x0020_By"] != null ? Convert.ToString(item["Created_x0020_By"]) : string.Empty,
               ModifiedBy = item["Modified_x0020_By"] != null ? Convert.ToString(item["Modified_x0020_By"]) : string.Empty,
               UniqueId = item["UniqueId"].ToString(),
               ServerRelativeUrl = Convert.ToString(item["FileRef"]),
               ListName = listName
         }))
    
         itemColl.Add(nitem);
    }
    catch (Exception ex)
    {
         // error log
    }
    return itemColl;
    }
    

    For this I used following reference,

    http://shahjinesh11.wordpress.com/2012/06/14/net-managed-client-object-model-fetch-all-webs-libraries-items/

    it may helps you Good Luck 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create applications in windows that has complete portability (within windows OSes
I want to create windows application in c# 2008. The problem is I don't
how can create a windows move maker like application in vb.net.... if we want
I want to create a windows phone screen which will display the some users
I want to create a companion Windows desktop program for my app. One that
I want to write an application using jsTree that would display and manipulate directory
I want to create a scroll view with a massive contentSize that will display
I've created a web application that I've hosted with IIS 7 on a Windows
I have created a windows mobile application in Visual Studio. I want to templatize
I want to create an application which main window has canvas (or something where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.