I am creating a C# Solution that will migrate the documents from SharePoint 2010 On-Premises to SharePoint Online.
I am done with the program. But when I run the program it runs successfully for few times. After some time it starts throwing error:
Microsoft.SharePoint.Client.IdcrlException: The sign-in name or password does not match one in the Microsoft account system.
I am unable to track the actual error.
Here I am sharing my code:
- public void CreateFolderStructures(MigrationFolders migrationFolders)
- {
- using (ClientContext clientContext = new ClientContext("Site URL")
- {
- string SPOnlineUsername = "Username";
- string SPOnlinePassword = "PASSWORD";
- foreach (char c in SPOnlinePassword)
- {
- securePassword.AppendChar(c);
- }
- clientContext.Credentials = new SharePointOnlineCredentials(SPOnlineUsername, securePassword);
- var list = clientContext.Web.Lists.GetByTitle(DocumentLibraryName);
- ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
- newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
- newItemInfo.LeafName = migrationFolders.FolderName;
- newItemInfo.FolderUrl = "SITEURL" + migrationFolders.FolderPath;
- ListItem newListItem = list.AddItem(newItemInfo);
- newListItem.Update();
- list.Update();
- clientContext.ExecuteQuery();
- newListItem["Modified"] = migrationFolders.ModifiedDDate;
- newListItem["Created"] = migrationFolders.CreatedDate;
- newListItem.Update();
- list.Update();
- clientContext.ExecuteQuery();
- }
- }
The above code is called in foreach loop.
I have gone through following URL but that is not the case with me.
- http://sharepointconnoisseur.blogspot.in/2015/09/how-to-resolve-error.html
- http://kb.cloudiway.com/sharepoint-the-sign-in-name-or-password-does-not-match-one-in-the-microsoft-account-system/
- https://knowledge-junction.com/2017/12/24/office-365-connecting-to-sharepoint-online-site-using-csom-when-multi-factor-authentication-mfa-is-enabled-for-the-user/
Any suggestion how to resolve this error?


Nanddeep NachanRank #38 · 35.2K reputationPosted Apr 4, 2018, 9:09 PM EDT
Nanddeep NachanRank #38 · 35.2K reputationPosted Apr 4, 2018, 9:19 PM EDT
Chanakya JayabalanRank #1,183 · 1.5K reputationPosted Jun 14, 2018, 6:50 AM EDT
Chanakya JayabalanRank #1,183 · 1.5K reputationPosted Jun 14, 2018, 8:09 AM EDT
Arutselvan MuthukannuRank #732 · 3.2K reputationPosted Jun 15, 2018, 11:55 PM EDT
https://www.c-sharpcorner.com/article/move-files-from-local-directory-to-sharepoint-library-using-pnp-provisioning/
karthick 2224 reputationPosted Jul 2, 2018, 12:17 AM EDT
Nanddeep NachanRank #38 · 35.2K reputationPosted Apr 3, 2018, 9:22 PM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Apr 3, 2018, 10:11 PM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Apr 4, 2018, 8:05 PM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Apr 4, 2018, 9:15 PM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Apr 4, 2018, 9:21 PM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Jun 14, 2018, 7:18 AM EDT
Aakash MauryaRank #114 · 19.8K reputationPosted Aug 2, 2019, 2:14 AM EDT