.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Retrieve the available lists from the Current site.

Posted By:Sagar Pardeshi       Posted Date: August 12, 2013    Points: 40    Category: SharePoint    URL: http://www.dotnetspark.com  

This client object model Retrieve All the list from current site
 

  
      this.Cursor = Cursors.WaitCursor;

            ListsListBox.Items.Clear();

            //Get a context

            using (ClientOM.ClientContext ctx =

                new ClientOM.ClientContext(UrlTextBox.Text))

            {

                //Get the site

                ClientOM.Web site = ctx.Web;

                ctx.Load(site);

                //Get Lists

                ctx.Load(site.Lists);

                //Query

                ctx.ExecuteQuery();

                //Fill List

                foreach (ClientOM.List list in site.Lists)

                {

                    ListsListBox.Items.Add(list.Title);

                }

                //Return the cursor to normal

                this.Cursor = Cursors.Default;

            }


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend