I'm trying to connect to a SharePoint list via a C# console application either using a functional ID or with the default credentials.
Option 1:
SpService.Credentials = CredentialCache.DefaultCredentials;
Option 2:
SpService.Credentials = new NetworkCredential(user, pw, domain);
If I use Option 1, the program runs successfully on my local computer but throws a 401 – Unauthorized
exception when ran on the server. If I use Option 2, it throws the same exception both locally and on the server on the GetListItems() method. If I don’t set the Credentials property at all, it also throws an exception in both places.
SpService.GetListItems(listName, null, query, viewFields, null, queryOptions, null);
I’ve tried to grant permissions to the functional ID in SharePoint, but the Add Permissions dialog cannot find the user.