I want to consume SharePoint data into a non .Net platform. I already use the SharePoint OOTB services like Lists.asmx, Webs.asmx and search.asmx for this purpose. I have successfully added support for forms based authentication using Authentication.asmx. Now, I want to provide support for Office 365 SharePoint online. For that purpose I have a demo SharePoint Online site that I am working on. Problem, I am facing is when I use Mode method of Authentication.asmx I get ‘Forms’ in response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ModeResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<ModeResult>Forms</ModeResult>
</ModeResponse>
</soap:Body>
</soap:Envelope>
However when I use Login.asmx and pass correct username and password, I get ‘PasswordNotMatch’ error, the same credentials are working fine in browser.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<LoginResult>
<ErrorCode>PasswordNotMatch</ErrorCode>
<TimeoutSeconds>0</TimeoutSeconds>
</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
Note:- This works perfect for a FBA non Office 365 SharePoint site.
Could somebody please help me in implementing the support for Office 365 SharePoint Online OOTB services?
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);
}
来源:https://stackoverflow.com/questions/8093358/authenticating-office-365-sharepoint-online-ootb-services