2
try
{
    web = context.Web;
    List list = context.Web.Lists.GetByTitle(listName);
    CamlQuery query = new CamlQuery();
    if (sprootpath == null)
    {
        query.FolderServerRelativeUrl = "/" + listName + "/";
    }
    else
    {
        query.FolderServerRelativeUrl = "/" + sprootpath + "/";
    }
    var listItems = list.GetItems(query);
    context.Load(listItems);
    context.ExecuteQuery();

}
catch (Exception ex)
{
    Debug.Write(ex);    
    return false;
}
  1. I tried ClientContext context = ClaimClientContext.GetAuthenticatedContext(siteUrl, 800, 600); which generated an auto pop up for login. Then after that the context object is passed to the method above.

  2. I tried clientCtx.Credentials = new NetworkCredential("username", "password", "domain")

  3. Checked SharePoint app pools, claim service in central admin & IIS admin services in Windows services are in running state. - Running

11
  • Make sure you have provided credentials Aug 19, 2017 at 8:44
  • I used ClientContext context = ClaimClientContext.GetAuthenticatedContext(siteUrl, 800, 600); method which generate auto pop up for login. Then after that context object passed to above mention method. Aug 19, 2017 at 10:53
  • Try clientCtx.Credentials = new NetworkCredential("username", "password", "domain"); & Check here also get error or not Aug 19, 2017 at 11:03
  • yes i try that. But same error 500 Internal server Aug 19, 2017 at 11:11
  • Check your SharePoint app pools, claim service in central admin & iis admin services in Windows services are in running state. Aug 19, 2017 at 11:15

1 Answer 1

0

This is salesforce example but very useful and help

https://help.salesforce.com/articleView?id=000221207&type=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.