Is there any option to execute CSOM code from .net core application? I have a bot solution from this i need to store all the conversation details in SharePoint list. When executing the code, i am getting 400 bad request error. How to resolve this? This is SharePoint online. My code will be published in Azure environment.
My code,
try
{
using (var ctx = new ClientContext(siteUrl))
{
ctx.Credentials = new SharePointOnlineCredentials(userName, password);
Web web = ctx.Web;
ctx.Load(web, w => w.Title);
ctx.ExecuteQueryAsync();
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Able to access Your site. Title - " + ctx.Web.Title);
}
}
catch (Exception ex)
{
Console.WriteLine("Unable to access your site. Please find the error below.");
Console.WriteLine(ex);
}
Getting "Microsoft.SharePoint.Client.PropertyOrFieldNotInitializedException: The property or field 'Title' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested." error.