Office 365 API - Creating New User, Getting Licensing Information; Which API to use?

12,389

You should use the Microsoft Graph API for this, which could be used in native apps and web applications. There are several examples available on connecting to the Microsoft Graph. The API reference could be found here: http://graph.microsoft.io

Or try the Graph Explorer to try the API: https://graphexplorer2.azurewebsites.net

To retrieve users with assigned licenses:

First get the subscribed Skus from your tenant using: https://graph.windows.net/rbd3v.onmicrosoft.com/subscribedSkus (Where rbd3v.onmicrosoft.com should be replaced with your tenant)

Next you could retrieve all users with the assigned licenses: https://graph.windows.net/rbd3v.onmicrosoft.com/users

Which will return something like this:

result

The SkuId of ‘assignedlicenses’ will match a license retrieved from the first request.

Get list of mail boxes

The same way you could retrieve all the mailboxes. By retrieving all the users and groups in your tenant and extract their email address. For an overview of available requests check: https://msdn.microsoft.com/Library/Azure/Ad/Graph/api/api-catalog

Hope this will help you!

Share:
12,389
Trinitrotoluene
Author by

Trinitrotoluene

Updated on July 25, 2022

Comments

  • Trinitrotoluene
    Trinitrotoluene almost 2 years

    My searches for this have come back completely in vain, I'm not even sure if it's possible.

    This is entirely possible in Powershell, and I already do this in Powershell but I want to write a C# program to perform certain tasks and cannot find which API would perform these kinds of tasks:

    1) Get licensing information for all users and their assigned plans

    2) Get a list of all mailboxes and e-mail addresses for a particular Office 365 Tenant.

    Easy to do in Powershell, but is there any kind of API that will do these type of overall management tasks?! If there is, I can't find it so any direction would be helpful