I am trying to use SPSite, SPWeb in my C# project. I get this error saying: "The type or namespace SPSite can not be found (are you missing an assembly reference)"
I have add 'using Microsoft.SharePoint.Client' in my code. And I have add 'Microsoft.Sharepoint.Client' as my assembly.
Thank you for your help.
The URL I am trying to access is 'https://mycompany.sharepoint.com/sites/parts/'.
So when I tried this to read the title of the page, I got a 403 error.
ClientContext context = new ClientContext("https://mycompany.sharepoint.com/sites/parts/");
var credentials = new NetworkCredential(mywindowsusername, mywindowspassword);
context.Credentials = credentials;
// The SharePoint web at the URL.
Web web = context.Web;
// We want to retrieve the web's properties.
context.Load(web);
// Execute the query to the server.
context.ExecuteQuery();
// Now, the web's properties are available and we could display
// web properties, such as title.
System.Console.WriteLine("Web Title");
System.Console.WriteLine(web.Title);