4

I am trying to see all the lists in my Site using sharepoint Client Object model , following is my code

   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();
 }

The above code throws following Error "The remote server returned an error: (500) Internal Server Error" Tried passing in the credentials too, but didn't work, tried passing DefaultNetworkCredentials too. No luck..

Please advice.

AnoojNair
  • 491
  • 3
  • 11
  • 18
  • 1
    you probably need to define the credential for accessing the site. try cc.Credentials = CredentialCache.DefaultCredentials or use user name and password cc.Credentials = new NetworkCredential(UID, PWD, DOMAIN); – Shawn Jan 24 '13 at 03:38

2 Answers2

7

Check everything below and make sure nothing has stopped running.

1. Check all of your app pools. iis

2. Check these SharePoint Services. sp

3. Check the IIS Admin Service. services

Chronozoa
  • 310
  • 6
  • 10
0

You need a credential before every executeQuery() :

ctx.Credentials = new NetworkCredential("LoginID", "LoginPW","LoginDomain");
Tony Wu
  • 1,040
  • 18
  • 28