TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Retrieve Only the Non Hidden Lists from SharePoint web using CSOM
Shantha Kumar T
Dec 31
2015
Code
2.8
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
//using Microsoft.SharePoint.Client;
//using System.Net
//GetNonhiddenLists(credentials, weburl);
//This method returns the lists from the web, which are visible to users
private
static
void
GetNonhiddenLists(ICredentials credentials,
string
weburl)
{
using
(ClientContext ctx =
new
ClientContext(weburl))
{
ctx.Credentials = credentials;
Web oweb = ctx.Web;
ListCollection lists = oweb.Lists;
var listsQuery = from lst
in
lists
where lst.Hidden !=
true
select lst;
IEnumerable<List> listcollection = ctx.LoadQuery(listsQuery);
ctx.ExecuteQuery();
Console.WriteLine(
"Non hidden Lists / Libraries: "
+ listcollection.Count().ToString());
foreach
(List lst
in
listcollection)
{
Console.WriteLine(lst.Title);
}
}
Console.WriteLine(
"Press any key to exit..."
);
Console.Read();
}
Non-Hidden
list
SharePoint