Unable to connect to the remote server RRS feed

  • Question

  • Hi Team,

    I am creating provider Hosted App and using visual studio 2013.

    when i am trying to execute a client context, i am getting unable to connect to the remote server.

    But same code i am able to access through Console application. 

     string loggedInUser = string.Empty;

    using (Microsoft.SharePoint.Client.ClientContext context = new Microsoft.SharePoint.Client.ClientContext(SPHostUrl))
                    PeopleManager peopleManager = new PeopleManager(context);
                    PersonProperties personProperties = peopleManager.GetPropertiesFor(Request.LogonUserIdentity.Name);
                    context.Load(personProperties, p => p.DisplayName);
                    loggedInUser = personProperties.DisplayName;
    Tuesday, April 25, 2017 7:09 AM

All replies