Authentication 连接到onedrive

Authentication 连接到onedrive,authentication,sharepoint,onedrive,Authentication,Sharepoint,Onedrive,我将为1000多个帐户将文件从文件服务器迁移到OneDrive。(无法使用迁移工具)。我拥有OneDrive的管理员权限,可以创建/编辑文件夹等 #Add required references to SharePoint client assembly to use CSOM [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") [System.Reflectio

我将为1000多个帐户将文件从文件服务器迁移到OneDrive。(无法使用迁移工具)。我拥有OneDrive的管理员权限,可以创建/编辑文件夹等

 #Add required references to SharePoint client assembly to use CSOM 
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")  

# Specify local folder path
$LocalFolder = "C:\test"

# Specify the User account for an Office 365 global admin in your organization
$AdminAccount = "admin@MY_ACCT_W_PERMS.onmicrosoft.com"
$AdminPass = "MY_SUPA_DUPA_SECRET_PWD"

# Specify User's OneDrive Site URL and Folder name
$OneDriveURL = "https://OurCompany-my.sharepoint.com/personal/name_domain_com"

$DocumentLibrary ="Documents"
$TargetFolderName ='' #Leave empty to target root folder

#Connect and Load OneDrive Library and Root Folder
$SecPwd = $(ConvertTo-SecureString $AdminPass -asplaintext -force) 
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($OneDriveURL) 
$Credentials = New-Object 
Microsoft.SharePoint.Client.SharePointOnlineCredentials($AdminAccount,$SecPwd) 
$Ctx.credentials = $Credentials
$List = $Ctx.Web.Lists.GetByTitle($DocumentLibrary)
$Ctx.Load($List)
$Ctx.Load($List.RootFolder)
$Ctx.ExecuteQuery()
等等

我得到一个错误: 使用“0”参数调用“ExecuteQuery”时出现异常:“标识客户端运行库(IDCRL) 无法查找联合登录的领域信息。“


我们已经有了MFA,我发现了一些建议,可以从cmdlet中删除-credentials参数,这样它会提示weblogin,但是如何呢????我迷路了。感谢您的帮助

好的,它似乎与权限有关,似乎管理员意外撤销了我在OneDrive中的权限