Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using the SharePoint SOAP web services to try collecting list and taxonomy data from a site on SharePoint Online.

The following code works nicely when connected to a standalone SharePoint farm. However, when connecting to SharePoint Online, the call to GetList fails with a SOAPException:

"Server was unable to process request. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

Code:

using (ListService.Lists service = new ListService.Lists())
{
    service.Credentials = new System.Net.NetworkCredential("username", "password");

    XmlNode list = service.GetList("Doclib");
}

using (TaxonomyService.Taxonomywebservice taxonomy = new TaxonomyService.Taxonomywebservice())
{
    // Set credentials
    taxonomy.Credentials = System.Net.CredentialCache.DefaultCredentials;

    for (int termSetCounter = 0; termSetCounter < allTermSetIds.Count; termSetCounter++)
    {
        int lcid = System.Globalization.CultureInfo.CurrentUICulture.LCID;

        string termStoreId = String.Format("<termSetIds><termStoreId>{0}</termStoreId></termSetIds>", allSharedServiceIds[termSetCounter]);
        string termSetId = String.Format("<termSetIds><termSetId>{0}</termSetId></termSetIds>", allTermSetIds[termSetCounter]);

        // Get one term set from term store using Web Service
        string resultXML = taxonomy.GetTermSets(termStoreId, termSetId, lcid, oldtimestamp, clientVersion, out timeStamp);

    }
}   

This blog post seems to indicate that the reason authenticating fails, is that Web Services against Office 365/SharePoint Online are not yet officially supported. There appears to be a workaround involving some shady gathering and pass-through of cookies from Internet Explorer, but this is a huge hack and I can't seem to get it working with a real-life application.

Microsoft does seem to have a list of Web Services available in SharePoint Online here, but this list does not seem to include the SOAP services mentioned above. I do not see any services that support taxonomy data either. Also, not even SharePoint Designer supports editing Taxonomy columns from the client-side. This does seem like a huge oversight, though.

Is there another way than Web Services to get access to list and taxonomy information from SharePoint Online sites? If not, is there any information available from Microsoft regarding when this will be supported?

share|improve this question
    
I am gettin exactly the same error but on a SP 2010 Enterprise Server and we are not using Claims Authentication. Any ideas on how to resolve this? –  threela Mar 28 '12 at 9:37
    
The error message only indicates that the credentials you have supplied aren't accepted by the server. If you don't find the answer, you should probably submit a separate question to sharepoint.stackexchange.com with the details of what you are trying to do. Users are discouraged from asking questions under an existing question. However, your issue is probably related to the service.Credentials object and the values you've set it to. Look at the NetworkCredentials class in .NET and see if it give you anything useful. –  Geir Smestad Mar 28 '12 at 14:30
add comment

2 Answers

You can connect to ShraPoint Online through the Client Object Model as show here: http://blogs.msdn.com/b/cjohnson/archive/2011/05/03/authentication-with-sharepoint-online-and-the-client-side-object-model.aspx

You can download the code sample and build on top of it. Get back to me if you need any help.

I agree that you think this is a "hack" but it works right now :)

share|improve this answer
add comment
up vote 2 down vote accepted

I have now received an answer from a Microsoft employee (SharePoint Solution Architect at an office in Scandinavia) regarding this question. The problem is that SharePoint Online uses Claims-based authentication, but the built-in .NET API officially only supports Default (NTLM) and Forms-based authentication. Microsoft (probably) does not plan to make any major changes to the API until the next major version of SharePoint is released, probably around 2013.

Therefore, at the present time, the official line for performing Claims-based authentication from .NET code is to use the workaround described above. You will end up with a CookieCollection object representing the Session ID for the current Claims-based authentication session, which can be used to create an authenticated ClientContext object or to authenticate any of the SharePoint web services...including TaxonomyClientService. This will let you get the term set data necessary to use Managed Metadata programmatically.

The source code in the link is a good starting point, but you probably have to run it in a separate thread due to a COM issue.

share|improve this answer
add comment

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.