Authentication with SharePoint Online and the Client Side Object Model

Also satisfied with SharePoint 2013 & office 365

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

code example:

http://code.msdn.microsoft.com/Remote-Authentication-in-b7b6f43c/sourcecode?fileId=21439&pathId=1351975828

 [STAThread]        

static void Main(string[] args)        

{            

using (ClientContext context=ClaimClientContext.GetAuthenticatedContext(yoursiteurl))            

{                                   Web web = context.Web;                 context.Load(web);                 context.Load(web.Lists);

                context.ExecuteQuery();

                foreach (var item in web.Lists)                 {                     Console.WriteLine(item.Title);                 }

                Console.ReadLine();             }         }

原文地址:https://www.cnblogs.com/csts/p/3030894.html