Powershell Office365图形api获取onedrive for business ID返回itemNotFound

Powershell Office365图形api获取onedrive for business ID返回itemNotFound,powershell,office365,onedrive,office365api,Powershell,Office365,Onedrive,Office365api,我想使用graph api获取某人的onedrive,以适应业务文件大小。 首先,我需要获取用户的驱动器id,但当我使用下面的脚本获取驱动器id时,返回ItemNotFound。 该帐户确实拥有onedrive的营业执照。 以及分配给以下权限的api。 AllSites.Read文件。Read文件。Read.All文件。ReadWrite文件。ReadWrite.All站点。Read.All站点。ReadWrite.All站点。Search.All用户。Read用户。Read.All用户。Rea

我想使用graph api获取某人的onedrive,以适应业务文件大小。
首先,我需要获取用户的驱动器id,但当我使用下面的脚本获取驱动器id时,返回ItemNotFound。
该帐户确实拥有onedrive的营业执照。
以及分配给以下权限的api。
AllSites.Read
文件。Read
文件。Read.All
文件。ReadWrite
文件。ReadWrite.All
站点。Read.All
站点。ReadWrite.All
站点。Search.All
用户。Read
用户。Read.All
用户。ReadWrite.All

$url = "https://graph.microsoft.com/v1.0/users/xxx@domain.com/drive"
$myReport2 =Invoke-RestMethod -UseBasicParsing -Headers $headerParams -Uri $url -Method Get -Verbose

这是图形api的设计问题。
只有Onedrive站点管理员可以使用graph api获取Onedrive文件信息。
使用下面的命令将图形api用户添加到onedrive站点管理员

$SiteUrl = "https://tenant-my.sharepoint.com/personal/username_domain_com/"
connect-sposervice -Url "https://tenant-admin.sharepoint.com/" -Credential Get-Credential
$sSecondaryODFBAdmin ="graphapi@tenant.onmicrosoft.com"
Set-SPOUser -Site $SiteUrl -LoginName $sSecondaryODFBAdmin -IsSiteCollectionAdmin $true

你问的问题需要更多的信息。请添加您正在采取的行动和您希望实现的目标的清晰描述,以及您希望使用的代码。那样的话,我们也许能为您提供一个很好的解决方案。
$SiteUrl = "https://tenant-my.sharepoint.com/personal/username_domain_com/"
connect-sposervice -Url "https://tenant-admin.sharepoint.com/" -Credential Get-Credential
$sSecondaryODFBAdmin ="graphapi@tenant.onmicrosoft.com"
Set-SPOUser -Site $SiteUrl -LoginName $sSecondaryODFBAdmin -IsSiteCollectionAdmin $true