how to solve Microsoft client property or field   not initialized  exception ?

Highlighted
Occasional Contributor

hi,

 

I  want to retrive sharepoint list data into  c#.net Project.

I have used Microsoft sharepoint client object model.

But,It gives Microsoft client property or field   not initialized  exception ?

How do i get sharepoint list data  in c#.project?

 

 

 

 

1 Reply
Highlighted
SecureString theSecureString = new NetworkCredential("", "ASDFGHHcxv").SecurePassword;

//SecureString password = abc;
string userName = "Txcvci@indica.onmicrosoft.com";
var ctx = new ClientContext("https://indica.sharepoint.com/sites/Testtej2");
ctx.Credentials = new SharePointOnlineCredentials(userName, theSecureString);

ctx.Load(ctx.Web.Lists);
ctx.ExecuteQuery();

foreach (var list in ctx.Web.Lists)
{
//if (list.BaseTemplate == 101)
{
Console.WriteLine(list.BaseTemplate);
Console.WriteLine("List Title: {0}", list.Title);
}
}


}