1

I tried to access a SharePoint Online web service i.e (/_vti_bin/Lists.asmx). I used the code sample provided in the following article :

http://blogs.msdn.com/b/cjohnson/archive/2011/05/14/part-2-headless-authentication-with-sharepoint-online-and-the-client-side-object-model.aspx

But this gives an error

The security timestamp is invalid because its creation time ('2013-11-29T08:23:58.000Z') is in the future. Current time is '2013-11-29T08:16:38.706Z' and allowed clock skew is '00:05:00'.

Anyone faced this issue? Please suggest.

Thanks

1 Answer 1

5

The method with which you are trying to authenticate is outdated. The SharePoint 2013 Client Object Model has now a class called SharePointOnlineCredentials which abstracts away all the tedious cookie container stuff. Eg:

using (ClientContext clientContext = new ClientContext("https://yoursite.sharepoint.com/"))
{
    SecureString passWord = new SecureString();

    foreach (char c in "yourpassword".ToCharArray()) passWord.AppendChar(c);

    clientContext.Credentials = new SharePointOnlineCredentials("[email protected]", passWord);

    Web web = clientContext.Web;

    clientContext.Load(web);

    clientContext.ExecuteQuery();

    Console.WriteLine(web.Title);

    Console.ReadLine();
} 

Read more about it here:

http://www.vrdmn.com/2013/01/authenticating-net-client-object-model.html

1
  • Thanks Vardhaman It worked :) Thanks again
    – Sushri
    Nov 29, 2013 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.