user13260866
user13260866

Reputation: 181

OneDrive Graph API: Get User ID associated with drive ID

I have an ID of an OneDrive drive. Is there any way I can figure out the user ID to whom the OneDrive drive belongs to?

Upvotes: 0

Views: 1035

Answers (1)

user2250152
user2250152

Reputation: 20605

When you call

GET /drives/{drive-id}

it returns Drive resource type with Owner property. It's the user account that owns the drive and it includes user id.

{
    "id": "b!t18F8ybsHUq1z3LTz8xvZqP8zaSWjkFNhsME-Fepo75dTf9vQKfeRblBZjoSQrd7",
    "driveType": "business",
    "owner": {
        "user": {
            "id": "efee1b77-fb3b-4f65-99d6-274c11914d12",
            "displayName": "John Doe"
        }
    },
    ...
}

Upvotes: 1

Related Questions