1
votes

I need to get a list of all sites available to the user, from a SharePoint 2013 server. Is there a way to authenticate with the SharePoint server, using network credentials?

Examples I see seem to pass a username, password and domain.

eg:

string _siteURL = "https://intranet.co.uk";

        NetworkCredential _myCredentials = new NetworkCredential("user", "password", "https://intranet");

        ClientContext _clientContext = new ClientContext(_siteURL);

        _clientContext.Credentials = _myCredentials;

Is there a way to NOT request a username/password from the user and get the list of sites available to the user?

2

2 Answers

0
votes

Domain in Network Credentials is not your website URL domain (https://sdbdbs), but your credentials domain (domain\username) . Figure out your domain name correctly.

0
votes

Is this code running from a console application? It should use following to use current user's credentials

 _clientContext.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;