EnjoySharePoint YouTube Channel

Display List collection using Autohosted apps in SharePoint 2013

In this post we will discuss how we can display list collection using auto-hosted apps. Also you can check out my previous posts on:

Get Office 365 Enterprise E3 Or Business Premium Subscription & Try out all the features

Check if list already exists or not using sharepoint 2013 client object model autohosted apps

Rename default Name column in SharePoint 2010 document library

Solution: Save Site as Template option not appearing under Site Action Section in Site Settings menu in SharePoint 2010

Here all lists are added by Feature using visual studio in autohosted apps.

string contextTokenString = TokenHelper.GetContextTokenFromRequest(Request);

SharePointContextToken contextToken =
TokenHelper.ReadAndValidateContextToken(contextTokenString, Request.Url.Authority);

Uri sharepointUrl = new Uri(Request.QueryString[“SPAppWebUrl”]);

string accessToken = TokenHelper.GetAccessToken(contextToken, sharepointUrl.Authority).AccessToken;

ClientContext clientContext = TokenHelper.GetClientContextWithAccessToken(sharepointUrl.ToString(), accessToken);

Web web = clientContext.Web;

ListCollection listcoll = web.Lists;

clientContext.Load(listcoll,lists => lists.Include(list => list.Title,list => list.Hidden).Where(list => !list.Hidden));


foreach (var list in listcoll)

Check out Best Alternative to InfoPath -> Try Now
You May Also like the Following SharePoint Tutorials:

About Navneet Singh

I am Navneet Singh, Working at C3it software solutions pvt. ltd. in Pune. My core skills are SharePoint 2013, Office 365, SharePoint 2010, SharePoint Designer, SharePoint Designer Workflow, Nintex Workflow, Infopath, Webpart, CSOM/SSOM, Power-shell, C#, ASP.NET and SQL Server.

View all posts by Navneet Singh →