Syed Mauze Rehan
Syed Mauze Rehan

Reputation: 1145

OneDrive/Office365:: Get all users for a tenant

I am looking for a way to fetch all users for my Office365 business solution. I am using Graph API to get all the users. Is there any other way? I have been trying this as well

https://{tenantName}-my.sharepoint.com/_api/Web/siteusers

Is this ok? Also, Graph API doesn't indicate that a user has active OneDrive. So rephrasing my question. How do I get all OneDrive users for an Office365 tenant?

Much appreciated.

Upvotes: 0

Views: 831

Answers (1)

Dan Kershaw - MSFT
Dan Kershaw - MSFT

Reputation: 5828

Sorry Syed - only just saw this. When you get users though Graph API, you can see their assigned licenses under the assignedPlans complex type. It'll look a bit like:

  "assignedPlans": [
    {
      "assignedTimestamp": "2014-12-09T23:12:18Z",
      "capabilityStatus": "Enabled",
      "service": "MultiFactorService",
      "servicePlanId": "8a256a2b-b617-496d-b51b-e76466e88db0"
    },
    {
      "assignedTimestamp": "2014-12-09T23:12:18Z",
      "capabilityStatus": "Enabled",
      "service": "AADPremiumService",
      "servicePlanId": "41781fb2-bc02-4b7c-bd55-b576c07bb09d"
    },
    {
      "assignedTimestamp": "2013-04-25T23:00:00Z",
      "capabilityStatus": "Deleted",
      "service": "SharePoint",
      "servicePlanId": "e95bec33-7c88-4a70-8e19-b10bd9d0c014"
    },
    {
      "assignedTimestamp": "2013-04-25T23:00:00Z",
      "capabilityStatus": "Deleted",
      "service": "SharePoint",
      "servicePlanId": "5dbe027f-2339-4123-9542-606e4d348a72"
    }
  ]

So if it contains a service called "SharePoint" with capabilityStatus of enabled, then this user has been assigned OneDrive for business.

Hope this helps

Upvotes: 1

Related Questions