Monday 25 April 2011

Office365 beta and the SharePoint 2010 Client Object Model

UPDATE: Microsoft has published the article on Authentication the Client Object Model on Office 365. You can find it here:

​I just got my Office365 beta license and configured a new Team Site in Sharepoint Online. Then I thought of accessing this new team site through the SharePoint 2010 .NET Client Object Model when I got the 403: Forbidden error code.

First, I thought that there might be some authenticaion issue so I tried accessing with both Classic Authentication and Claims based authentication.

Forms Based Authentication(Client Object Model):

clientcontext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;

clientcontext.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo("username", "password");

Web Service Login:

AuthService.Authentication auth = new AuthService.Authentication();
auth.Url = "";
auth.CookieContainer = new System.Net.CookieContainer();
AuthService.LoginResult loginresult = auth.Login("username","password");

With both the cases, it gave me the following error:

"Server was unable to process request. ---> The server was unable to process the request due to an internal error."


I tried accessing the lists of Office365 through the Lists service:

ListService.Lists list = new ListService.Lists();

list.Credentials = new NetworkCredential("username", "password");

var res = list.GetList("Documents");

but got this clear cut error:

"Server was unable to process request. ---> Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

After some digging aroung, I found out that indeed right now, support is not there for the client object model and the only way to currently use the Client Object Model with SharePoint Online is to get the FedAuth Cookie (from fiddler) and then include that cookie in your call from the code. But this is not the best practice and is highly discouraged.

Hopefully, the Office 365 team will include the Client Object Model as soon as possible. I will update it here as soon as there is any news regarding the issue.


सत्यजित said...

Hi Vardhaman,
I am trying to consume Web-services of Office e365 SharePoint Online but gives same error(403 Forbidden)

Do u have any idea hot to authenticate web-services?

Vardhaman Deshpande said...

Hi Satyajeet,

Can you tell me why are you using WebServices? With Office 365, you have to the Client Object Model which is just a wrapper on the Web Services and is more robust. Also, for Web Services, you can check out the following link: