Title: Get Site URL and Title using CSOM.
Step1:
Follow the http://sharepoint-lakku.blogspot.in/p/csom-setup.html steps.
Step2:
Add below configurations in app.config
Step3:
Add below reference.


Step4:
Add below name spaces in code
using System;
using Microsoft.SharePoint.Client;
using System.Configuration;
using System.Security;
Step5:
Add below code
static void Main(string[] args)
{
string siteURL = ConfigurationManager.AppSettings["mysiteurl"];
string userName = ConfigurationManager.AppSettings["myusername"];
string password = ConfigurationManager.AppSettings["mypassword"];
using (var clientContext = new ClientContext(siteURL))
{
SecureString securePassword = new SecureString();
foreach (char c in password.ToCharArray()) securePassword.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials(userName, securePassword);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
Console.WriteLine(web.Title + " , " + web.Url);
Console.ReadKey();
}
}
Out Put:
Step1:
Follow the http://sharepoint-lakku.blogspot.in/p/csom-setup.html steps.
Step2:
Add below configurations in app.config
- <appSettings>
- <add key="mysiteurl" value="https://office365.sharepoint.com/sites/lakku"/>
- <add key="myusername" value="sudip@hpeoffice365.onmicrosoft.com"/>
- <add key="mypassword" value="mypass@123"/>
- </appSettings>
Step3:
Add below reference.
Step4:
Add below name spaces in code
Step5:
Add below code
Out Put: