Skip to main content

Posts

Showing posts from August, 2017

C#: Create Connection to SharePoint and Dynamic 365

How to Create Connection to SharePoint and Dynamic CRM using C#. Connection establish in SharePoint using C# Reference DLL you need for this code is -  Microsoft.SharePoint.Client.Latest by Trujillo Microsoft.SharePoint.Client.Runtime by Trujillo Below mention is c# code - public static string SharePointUrl = "https://CompanyName.sharepoint.com/"; public static string UserName = "UserName@CompanyName.onmicrosoft.com", PassWord = "o365_Password"; static void Main(string[] args) { //----------Establish a connection with Microsoft SharePoint. SecureString passWord = new SecureString(); foreach (char c in PassWord.ToCharArray()) passWord.AppendChar(c); using (ClientContext clientContext = new ClientContext(SharePointUrl)) { try { clientContext.Credentials = new SharePointOnlineCredentials(UserName, passWord); } catch (Exception ex) { Console.WriteLine("erro