Authenticating Office 365 SharePoint Online OOTB services

*爱你&永不变心* 提交于 2019-12-03 14:59:06

I've been looking into a similar idea and this thread has been extremely helpful. They actually have a webservice sample using the PInvoke, it might help you get there.

Edit: my search led me to this other post by Wictor Wilen, but trying to avoid the ClientOM for now.

Edit2: alright, got this working. Using the code from Wictor above, I downloaded his sample solution and moved "MsOnlineClaimsHelper.cs" and "WcfClientContracts.cs" to my project, I will be fiddling with what is really used from these files later. I only changed them to remove the ClientOM references including the clientContext_ExecutingWebRequest method.

In a sample MVC3 app or Console app:

MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper("https://my365site.sharepoint.com/sites/enterprise/", "admin@my365site.onmicrosoft.com", "secret");

using (var lists = new SharePointLists.Lists())
{
    lists.Url = @"https://my365site.sharepoint.com/sites/enterprise/_vti_bin/lists.asmx";
    lists.CookieContainer = claimsHelper.CookieContainer;
    var listCol = lists.GetListCollection();
    ViewBag.Message = listCol.InnerXml;
    //Console.Write(listCol.InnerXml);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!