Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

We have an application that periodically pulls data from a SharePoint list and integrates with another application. We've been using it for more than a year without a problem. Recently, however, we switched our farm to use claims-based authentication... and there went the app.

My code, at a high level, does the following:

SPWebRefs.Lists spl = new SPWebRefs.Lists();
spl.Credentials = System.Net.CredentialCache.DefaultCredentials;

//Build request here


XmlNode listItems = spl.GetListItems("My list", view, query, viewFields, null, queryOptions, null);

I get an "Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown" exception right there.

I'm looking through Fiddler, and I get the 401 challenge, quickly followed by a 200 response, which I assume means I'm in. But then I get a 500 error as soon as the GetListItems method is invoked.

I've tried this against a 2010 instance as well as a 2013 farm that we're getting ready to deploy. Same situation.

I'm using the 4.0 Framework at this point, but I've considered testing it out against the 4.5 Framework, which includes some new APIs for claims authentication. Would that make any difference?

Any thoughts would be greatly appreciated. Thanks so much in advance!

share|improve this question

1 Answer 1

You must call SharePoint's Authentication WebService first. You will get a cookie from it, which you can pass to the Lists WebService.

See a sample here: http://www.tonytestasworld.com/post/2009/06/04/How-To-Authenticate-and-Use-SharePoint-Web-Services-in-an-FBA-SharePoint-site.aspx

share|improve this answer
    
Thanks @Doomdrake, I tried that. However, I'm getting a 401 response when hitting the auth webservice (and the credentials are correct -- tested them with domain\user, user and claims-syntax domain\user(. Also, your link deals with FBA scenarios. Is there anything I'm missing? Thanks! N –  napo Oct 16 '13 at 18:03
    
Can you update your code and mark the position of the exception? The authentication.aspx service should not require any authentication, so a 401 is strange. –  Doomdrake Oct 17 '13 at 8:31
    
I tested the code right from the example you provided: using (AuthenticationSvc.Authentication authSvc = new AuthenticationSvc.Authentication()) { authSvc.Url = @"https:\\myURLrightHere"; authSvc.CookieContainer = new System.Net.CookieContainer(); authSvc.AllowAutoRedirect = true; AuthenticationSvc.LoginResult result = authSvc.Login("username", "password"); ... } And that's where the exception is thrown -- trying to instantiate result. –  napo Oct 17 '13 at 14:56
    
(Sorry about the one-liner right there. Can't seem to get it to go over more than one line. :) ) –  napo Oct 17 '13 at 15:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.