I'm new to Sharepoint generally, and need to write an app which will do some basic file management. First, though, it needs to log in.
The documentation I've found suggests that:
var clientContext = new ClientContext("https://company.sharepoint.com/");
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
clientContext.FormsAuthenticationLoginInfo = new FormsAuthenticationLoginInfo(username, password);
Web web = clientContext.Web;
clientContext.Load(web);
clientContext.ExecuteQuery();
should connect to the server and get some basic information.
However, I'm getting an exception: "The user's login name or password is not valid.". I'm using my own credentials, with which I've logged into Sharepoint several times in a browser.
What am I doing wrong?