var items;
    url: 'https://my365Site.sharepoint.com' + "/_api/web/siteusers",
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    success: function(data) {


    error: function(error) {

Using this i am able to get all the user list but not able to identify which user having the licence and which one not.


You can use powershell to get license information:

#Connecting to Azure Active Directory

#This first command will import the Azure Active Directory module into your PowerShell session.
Import-Module MSOnline

#Capture administrative credential for future connections.
$credential = get-credential

#Establishes Online Services connection to Azure Active Directory  
Connect-MsolService -Credential $credential

Get-MsolUser | Where-Object { $_.isLicensed -eq "TRUE" -and $_.Licenses[0].ServiceStatus[3].ProvisioningStatus -ne "Disabled" } | Select-Object UserPrincipalName, DisplayName,{$_.Licenses.AccountSkuId} | Export-Csv c:\LicensedUsers.csv

Reference - Report on O365 users


Or you can also try using the Graph API (probably need Azure AD permission, not very sure).

First make the request to get all subscribes SKUs as below:




After that make a request to get all users as below:


or (below works for me,but its still in beta)


The response should be something as below:

        "id": "cf4abbb5-73dd-4ba6-8411-731ec326bb17",
        "accountEnabled": true,
        "assignedLicenses": [
                "disabledPlans": [],
                "skuId": "8601034c-e1a0-4176-acb5-f25f5a323116"
                "disabledPlans": [],
                "skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900"
        "assignedPlans": [
                "assignedDateTime": "2016-11-29T22:25:04Z",
                "capabilityStatus": "Enabled",
                "service": "PowerAppsService",
                "servicePlanId": "c68f8d98-5534-41c8-bf36-22fa496fa792"
                "assignedDateTime": "2016-11-29T22:25:04Z",
                "capabilityStatus": "Enabled",
                "service": "ProcessSimple",
                "servicePlanId": "76846ad7-7776-4c40-a281-a386362dd1b9"

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

Reference - Graph API

| improve this answer | |
  • Thanks @Gautam But i want to get this in JSOM OR in REST because i need to run this in SharePoint Hosted App. – Savan Gupta Feb 14 '17 at 7:27
  • Check updated answer . Not sure why you need it using SP hosted app, would be better if you use powershell, this will take more processing time i believe. – Gautam Sheth Feb 14 '17 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.