I am using .NET 8.0 C# for connecting to SharePoint. I am getting an error:
The type or namespace SharePointOnlineCredentials" could not be found.
I have added NuGet packages but still I am getting this error.
using (ClientContext ctx = new ClientContext("myUrl")){ SecureString password = new SecureString(); foreach (char c in "MyPassword".ToCharArray()) password.AppendChar(c); ctx.Credentials = new SharePointOnlineCredentials("MyMailid", password); Web myWeb = ctx.Web; ListCreationInformation listinfo = new ListCreationInformation(); listinfo.Title = "Company_Announcemennt"; listinfo.Description = "Add company announcements here!"; listinfo.TemplateType = (int)ListTemplateType.Announcements; List myList = myWeb.Lists.Add(listinfo); myList.OnQuickLaunch = true; myList.Update(); ctx.ExecuteQuery();}