Connection-Authentication from CRM Online Plugin to SharePoint online RRS feed

  • Question

  • I am writing a plugin in Dynamics CRM on Opportunity Update and want to send Opportunity data to SharePoint Online List as an Item.

    I was using the following details to connect to SharePoint on Premises that worked fine, but now when I connect to SharePoint Online it generated "Access Denied" etc Security Error.

    string _siteUrl = "mxxxxxx11.sharepoint.com";
    string _userName = "xxxxxxx365@XXXXXX.onmicrosoft.com";
    string _password = "pXXXXXXX23";
    string _domain = "mydemo11@onmicrosoft.com";

    com.sharepoint.domain.Lists listService = new com.sharepoint.domain.Lists();
    listService.Url = _siteUrl;
    listService.Credentials = new System.Net.NetworkCredential(_userName, _password,_domain);

    System.Xml.XmlNode ndListView = listService.GetListAndView("Account", "");
    string strListID = ndListView.ChildNodes[0].Attributes["Name"].Value;
    string strViewID = ndListView.ChildNodes[1].Attributes["Name"].Value;

    The above code worked for on Premises SharePoint Server but not for SharePoint Online,

    Please guide me how to connect to a SharePoint Online from CRM online Plugin.

    Saturday, September 12, 2015 12:00 PM