Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Connecting SharePoint site using CSOM

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 296
    Comment on it

    This code packet will help you to authenticate to O365 using Client Side Object Model(CSOM). It uses the  SharePointOnlineCredentials class to get clientContext of SharePoint. Let try it yourself.


    // Namespaces
    using System;
    using System.Security;
    using Microsoft.SharePoint.Client;
    // String Variable to store the siteURL
    string webUrl = "";
    // String Variable to store the user name
    string userName = "";
    // String Variable to store the password
    string password = "xxxxxxxxxx";
    SecureString securePassword = new SecureString();
    foreach (char ch in password)
    using (ClientContextcontext = new ClientContext(webUrl))
      context.Credentials = new SharePointOnlineCredentials(userName,password);
      // To retrieve the web's title.
      context.Load(context.Web, w => w.Title);
      // Execute the query to the server.


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: