OneDrive 未配置

OneDrive not provisioning

我正在尝试为用户创建一个帐户,并使用 OneDrive 对其进行配置。该应用程序具有所有必需的权限,并且用户拥有包含 OneDrive for Business 的许可证。

当使用来自 Microsoft Graph 的 /v1.0/users/username/drive 端点配置 OneDrive 时,如“获取用户的 OneDrive”下的 documentation 中所述,出现以下错误:

{
  "error": {
    "code": "ResourceNotFound",
    "message": "User's mysite not found.",
    "innerError": {
        "request-id": "996c75c0-19d5-416e-8070-e9af593ae1d7",
        "date": "2017-11-08T08:23:22"
        }
    }
}

OneDrive 未配置,即使我在一段时间后检查也是如此。但是,当我通过为用户登录 OneDrive 手动配置它时,它确实如此。

所以我的问题是; 为什么没有配置用户的 OneDrive?


刚刚找到一个相关的question

Documentation所述:

If a user's OneDrive is not provisioned but the user has a license to use OneDrive, this request will automatically provision the user's drive, when using delegated authentication.

这里的关键位是 "delegated authentication"。这表明 API 仅在上下文中存在 user 时提供 Drive。换句话说,您的应用必须使用 authorization_codeimplicit OAUTH 授权才能触发自动配置。

如果您正在使用 "application authentication"(即 client_credentials 授权),则不会触发自动配置。