Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authorization to Office 365/Sharepoint online

I writing a WCF service that is hosted in Azure as a (PaaS). The service in turn needs to talk to Sharepoint 2013 Online/Office 365.

I was looking at using the Sharepoint Client object model to talk to it, but keep getting the following error: "The remote server returned an error: (403) Forbidden" When we login to access the SharePoint instance through a browser it usually takes you to https://login.microsoftonline.com/login.srf so you can log in using a Live Id. The problem is we are using a federated account and not a Live Id, and therefore get redirect again to a adfs site to login . I've looked at a code sample at http://www.wictorwilen.se/Post/How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx that is using claims based authentication, but this always fails with an "Authentication Failed" message when trying to retrieve Saml Token.

If I understand this correctly. One way of doing this is to get the Saml Token, pass this to SPO, which will in turn return two cookies which I need to include in the requests made with the Client object model. Problem is I'm not finding any proper examples on how to authenticate using the Federated account in C#.

Can anyone point me in the right direction, as to how I might proceed authorizing my WCF service to talk to SharePoint.

Sorry if this is in the wrong forum. I'm not exactly sure whether this is an Azure issue or just SharePoint as I'm pretty new to both technologies.

like image 390
Werner du Plessis Avatar asked Nov 21 '12 09:11

Werner du Plessis


1 Answers

Try the following blog article. The ability to access the Office 365 API was just announced last month and the ability to call this from your web service is pretty new. This article is a good tutorial on the subject.

like image 92
RimskyDon Avatar answered Sep 21 '22 13:09

RimskyDon