Solved

Office 365 SharePoint Online web service authentication

Posted on 2014-09-18
1
934 Views
Last Modified: 2014-09-24
Using Visual Studio 2008 and VB.net

I have a Windows Forms application that calls a SharePoint (WSS 3.0) web service on a SharePoint intranet site with this code:
Dim lists As MyLists.Lists = New MyLists.Lists()
lists.UseDefaultCredentials = True
lists.Url = gblstrListsURL
Dim nodes As XmlNode = lists.GetListItems(strDocumentLibrary, "", Nothing, Nothing, "", Nothing, Nothing)

Open in new window

We are migrating from WSS 3.0 to SharePoint Online (Office 365) so I created a new web reference to point to the new SharePoint Online site.

This line
Dim nodes As XmlNode = lists.GetListItems(strDocumentLibrary, "", Nothing, Nothing, "", Nothing, Nothing)

Open in new window

now produces this error

System.Web.Services.Protocols.SoapException: Server was unable to process request - Access id denied. (Exception for HRESULT: 0x8007005 (E_ACCESSDENIED))

I am a site administrator on the SharePoint Online site.  I found a method to authenticate with SharePoint Online at this link:
http://blogs.msdn.com/b/cjohnson/archive/2011/05/03/authentication-with-sharepoint-online-and-the-client-side-object-model.aspx 
or  Authentication with SharePoint Online

So, my code is now:

Dim authCookie As System.Net.CookieCollection
authCookie = ClaimClientContext.GetAuthenticatedCookies("https://MyDomain.sharepoint.com/sites/testSite/", 925, 525)
Dim lists As MyLists.Lists = New MyLists.Lists()
lists.CookieContainer = New System.Net.CookieContainer()
lists.CookieContainer.Add(authCookie)

However, the program is getting a compile error and will not build for this reason:

Name ‘ClaimClientContext’ is not declared.

I’ve tried unsuccessfully to resolve the problem by searching for a Namespace or project reference.  Any suggestions on how to fix or do this a different way?  Thanks
0
Comment
Question by:waverazor
1 Comment
 
LVL 31

Accepted Solution

by:
Jamie McAllister MVP earned 500 total points
ID: 40330230
I imagine you've seen this;

http://blogs.msdn.com/b/sharepointdev/archive/2011/05/12/connecting-to-sharepoint-online-web-services.aspx

My reading of this is that there's a reference needed to  System.Windows.Forms.WebBrowser

http://msdn.microsoft.com/en-us/library/hh147177.aspx

Though in the original article I'm confused by the reference to using MSDN.Samples.ClaimsAuth;

I'm wondering if there's something available in their sample here: http://code.msdn.microsoft.com/Remote-Authentication-in-b7b6f43c  ?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pimping Sharepoint 2007 without Server-Side Code Part 1 One of my biggest frustrations with Sharepoint 2007 in the corporate world is that while good-intentioned managers lock down the more interesting capabilities of Sharepoint programming in…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question