1
votes

I'm trying to create an account for a user, and provision it with OneDrive. The application has all the required rights, and the user has a license which includes OneDrive for Business.

When using /v1.0/users/username/drive endpoint from Microsoft Graph to provision the OneDrive, as stated in the documentation under 'Get a user's OneDrive', the following error presents itself:

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

The OneDrive doesn't get provisioned, not even if I check after some time. When I go to provision it manually by logging into OneDrive for the user however, it does.

So my question is; why doesn't the user's OneDrive get provisioned?


Found a related question just now.

1

1 Answers

2
votes

As mentioned in the 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.

The key bit here being "delegated authentication". This is stating that the API will only provision a Drive when there is a user in context. In other words, your app must be using either the authorization_code or implicit OAUTH grant for automatic provisioning to be triggered.

If you're using "application authentication" (i.e. the client_credentials grant), automatic provisioning won't be triggered.