I wrote a simple code in CSOM to get web title. Hope code is fine. When I execute my application I got an exception from my third line
(clientContext.Credentials = new SharePointOnlineCredentials("Domain\\Username", SecurePassword);)
Username argument is invalid
Any idea to solve this issue? Thanks in advance.
using (var clientContext = new ClientContext("http://siteURL"))
{
SecureString SecurePassword = GetSecureString("password");
clientContext.Credentials = new SharePointOnlineCredentials("Domain\\Username", SecurePassword);
Web web = clientContext.Web;
clientContext.Load(web,
webSite => webSite.Title);
clientContext.ExecuteQuery();
Console.WriteLine(web.Title);
}
SharePointOnlineCredential
. What actual version of SharePoint you are using? SPO or SP? – Aakash Maurya Jun 22 '17 at 12:01