This SharePoint Online tutorial explains how to solve error “the sign-in name or password does not match one in the Microsoft account system” which comes while working with csom in SharePoint Online.
Recently I was trying to bind list templates to a dropdown list using client-side object model (csom) in SharePoint Online using visual studio 2017. While retrieving list items it gave below error: Microsoft.SharePoint.Client.IdcrlExpection: The sign-in name or password does not match one in the Microsoft account system. The error looks like below:
I was using the below csom code to retrieve items from a SharePoint list.
void BindItemsToDropDownList()
{
using (ClientContext clientContext = new ClientContext("https://onlysharepoint2013.sharepoint.com/sites/Raju"))
{
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new SharePointOnlineCredentials("[email protected]", GetSPOSecureStringPassword());
Web web = clientContext.Web;
ListTemplateCollection templateColl = web.ListTemplates;
clientContext.Load(templateColl);
clientContext.ExecuteQuery();
//Further Code
}
}
private SecureString GetSPOSecureStringPassword()
{
try
{
var secureString = new SecureString();
foreach (char c in "YourAccountPassword")
{
secureString.AppendChar(c);
}
return secureString;
}
catch
{
throw;
}
}
}
the sign-in name or password does not match one in the Microsoft account
The error was coming because the Password was not correct for the Office 365 account user name I was trying.
The problem was I was not using that account from a long time, so the account password expired already. So I had to reset my Office 365 account password and then update the new password in csom code. Then it started working.
Once I gave the correct password, the error “the sign-in name or password does not match one in the Microsoft account” did not come.
You may like following SharePoint csom examples:
- the remote server returned an error 500 internal server error. SharePoint client object model
- the remote server returned an error (403) forbidden SharePoint client object model
- Steps to add items from CSV file to SharePoint Online List using PowerShell in CSOM
- How to Use CAML Query for Boolean field for SharePoint 2013/2016/Online Object Model CSOM
Hope this SharePoint tutorial helps to solve the sign-in name or password does not match one in the Microsoft account system error in SharePoint.
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
One other possibility for this error that I would like to add, is when Multi Factor Authentication is enabled. When your username and password is correct, you can still run into this.
This is especially hard to identify when MFA only kicks in when certain conditions are met, ex. when you are not on your company network. In this way the scenario can work from your own machine, but when you deploy it to Azure it will fail with the same username and password combination.
how can we resolve this with user name password and siteurl to authenticate MFA enabled users.
Leaving out the credential in case of 2FA being enabled works too!
Hello Jeremy! Can you explain that method?