none
unable to connect remote server in sp 2010 using csom RRS feed

  • Question

  • Hi all iam using below code to access list items but in executequey line iam getting unable to connect remote server error.

                string siteUrl = "http://test_aass/";  
                ClientContext clientContext = new ClientContext(siteUrl);  
                SP.List oList = clientContext.Web.Lists.GetByTitle("abc");  
      
                CamlQuery camlQuery = new CamlQuery();  
                camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";  
      
      
                ListItemCollection collListItem = oList.GetItems(camlQuery);  
      
                clientContext.Load(collListItem);  
      
                clientContext.ExecuteQuery();  

    Please help.Thanks in advance.

    Wednesday, January 2, 2019 10:29 AM

Answers

  • Hi Praveenrangu,

    I tested the code below by adding credential to a root site, it is working:

    I think you should check the root site permission, make sure the passed user has permission to access the root site.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Praveenrangu Saturday, January 5, 2019 4:46 PM
    Thursday, January 3, 2019 5:41 AM

All replies

  • Hi

    Please try to add NetworkCredential to your context object.

    ctx.Credentials = new NetworkCredential("username", "password", "domain");


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Thursday, January 3, 2019 3:29 AM
  • Thanks for your reply.If i added this line of code also same issue iam facing.But the subsite its working with out passing credentials as well.Facing issue with root site.
    Thursday, January 3, 2019 4:29 AM
  • Sub site works but root site has an issue?

    Does your sub site have unique permission?


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Thursday, January 3, 2019 5:04 AM
  • Hi Praveenrangu,

    I tested the code below by adding credential to a root site, it is working:

    I think you should check the root site permission, make sure the passed user has permission to access the root site.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by Praveenrangu Saturday, January 5, 2019 4:46 PM
    Thursday, January 3, 2019 5:41 AM