Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Office 365 SharePoint Online web service authentication

Posted on 2014-09-18
1
Medium Priority
?
1,320 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 32

Accepted Solution

by:
Jamie McAllister MVP earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
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…
Loops Section Overview

885 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