This project is read-only.

The request failed with HTTP status 401: Unauthorized.

Feb 4, 2008 at 3:13 AM

I have successfully created the .smpl file using custom credentials, I can access the objects and create a linq query but when I run the console app I am getting the
The request failed with HTTP status 401: Unauthorized
Exception when I try and access the lists.

Feb 7, 2008 at 8:11 AM

I assume you're using the built-in web service provider based on what I infer from your explanation on how the spml got generated using custom credentials. Currently we don't store the user name and password used in entity generation in the generated code; this is done because most likely the developer will specify his/her own (administrator?) account while we don't want to:

a) leak those credentials
b) enforce that user account to be used at runtime

Instead, the used default account are the Windows network credentials of the user executing the code. If you want to override these, you'll have to set the Credentials property on the context object like this:

var ctx = new MySharePointDataContext();
ctx.Credentials = new NetworkCredential(user, password, domain);

This is consistent with the way generated web service proxies in .NET work (see

Feb 7, 2008 at 9:21 AM
Thanks Bart works perfectly , I am looking forward to the prod release