Question

I am unable to log in to SharePoint via "Windows Phone Sharepoint App". Emulator just says "Invalid Username or Password. Please Try Again" I tried several SharePoint websites, several log Ins, automatically and manually filled in correct credentials, but yet same result. Here is my code:

    ClientContext context = new ClientContext("https://website.sharepoint.com/");

    Authenticator _auth = new Authenticator();

    _auth.UserName = "login@website.onmicrosoft.com";
    _auth.Password = "password";
    _auth.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;

    _auth.CookieCachingEnabled = true;

    context.Credentials = _auth;

    ListItemCollection items = context.Web.Lists.GetByTitle("CALL_STATUS").GetItems(CamlQuery.CreateAllItemsQuery());

    context.Load(items);
    context.ExecuteQueryAsync((object obj, ClientRequestSucceededEventArgs args) =>
    {
        Console.WriteLine("Connected");
    },
    (object obj, ClientRequestFailedEventArgs args) =>
    {
        Console.WriteLine("Could not connect");
    }); 

Please help. I'm desperate :(

Was it helpful?

Solution

Problem was with Authentication mode. I was trying to log in to Microsoft.Online using FormsAuthentication. How did I only miss it...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top