Solved

Office 365 SharePoint Online web service authentication

Posted on 2014-09-18
1
806 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
We had a requirement to extract data from a SharePoint 2010 Customer List into a CSV file and then place the CSV file into a directory on the network so that the file could be consumed by an AS400 system. I will share in Part 1 how to Extract the Da…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now