Solved

Office 365 SharePoint Online web service authentication

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 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

15 Experts available now in Live!

Get 1:1 Help Now