Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Office 365 SharePoint Online web service authentication

Posted on 2014-09-18
1
Medium Priority
?
1,202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

730 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