Getting Organization Users

In this article

    You can get a resource representation of an organization users.

    Request

    GET https://<hostname>:4443/v6/Organizations/{organizationId}/Users?displayName=<string>&userName=<string>&locationFilter=<string>

    Request Headers

    The request header must contain an authorization token of the current session.

    Request Parameters

    The following parameters must be specified in the URL of the request:

    Parameter

    Type

    Description

    organizationId

    string

    Specifies the identification number of the Microsoft 365 organization. For more information on how to get this parameter, see Getting Organizations.

    The following optional parameters can be specified in the URL of the request:

    Parameter

    Type

    Description

    displayName

    string

    Specifies a display name of the organization user.

    userName

    string

    Specifies an email address of the organization user.

    locationFilter

    string

    Note: Use this parameter for organizations of the Hybrid type.

    Specifies an organization user location type. The following types are available:

    • Cloud
    • OnPremises
    • Hybrid
    • CloudOrHybrid
    • OnPremisesOrHybrid
    • Any

    Request Body

    None.

    Response

    The server returns the following response to the client.

    Response Codes

    A successfully completed operation returns a response code 200 OK.

    Response Headers

    The response to this request contains the following headers. The response may also include additional standard HTTPS headers.

    Header

    Description

    Content-length

    The length of the response body.

    Content-type

    The media type and syntax of the response body message: application/json; charset=utf-8

    Response Body

    In the response body, the server returns a resource representation of the /Organizations/{organizationId}/Users collection resource.

    Examples

    Example 1

    The example returns a list of users for an organization with the specified ID.

    Request:

    GET https://abc.tech.local:4443/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    {

     "offset": 0,

     "limit": 30,

     "_links": {

       "self": {

         "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?offset=0&limit=30&setid=cfadb22c-d1ee-4a56-8da4-801bfd3fbbe9"

       },

       "next": {

         "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?offset=30&limit=30&setid=cfadb22c-d1ee-4a56-8da4-801bfd3fbbe9"

       }

     },

     "results": [

       {

         "id": "9bdd0fca-7210-450e-bfeb-c0dca2e1b36c00000000-0000-0000-0000-000000000000",

         "displayName": "User1",

         "name": "user1@abc.onmicrosoft.com",

         "type": "User",

         "locationType": "Cloud",

         "_links": {

           "self": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/9bdd0fca-7210-450e-bfeb-c0dca2e1b36c00000000-0000-0000-0000-000000000000"

           },

           "organization": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

           },

           "onedrives": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/9bdd0fca-7210-450e-bfeb-c0dca2e1b36c00000000-0000-0000-0000-000000000000/onedrives"

           }

         }

       },

       {

         "id": "540f686f-e268-4658-a742-cb8be395c19600000000-0000-0000-0000-000000000000",

         "displayName": "User2",

         "name": "user2@abc.onmicrosoft.com",

         "type": "User",

         "locationType": "Cloud",

         "_links": {

           "self": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/540f686f-e268-4658-a742-cb8be395c19600000000-0000-0000-0000-000000000000"

           },

           "organization": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

           },

           "onedrives": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/540f686f-e268-4658-a742-cb8be395c19600000000-0000-0000-0000-000000000000/onedrives"

           }

         }

       },

    }

     ],

     "setId": "cfadb22c-d1ee-4a56-8da4-801bfd3fbbe9"

    }

    Example 2

    The example returns information about a user by the organization ID and the userName filter parameter.

    Request:

    GET https://abc.tech.local:4443/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?userName=administrator@abc.onmicrosoft.com

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    {

     "offset": 0,

     "limit": 30,

     "_links": {

       "self": {

         "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?username=administrator@abc.onmicrosoft.com&offset=0&limit=30&setid=aa1218cd-5356-4d83-9268-3f7eb9f5e8e4"

       }

     },

     "results": [

       {

         "id": "88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000",

         "displayName": "Administrator",

         "name": "administrator@abc.onmicrosoft.com",

         "type": "User",

         "locationType": "Cloud",

         "_links": {

           "self": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000"

           },

           "organization": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

           },

           "onedrives": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000/onedrives"

           }

         }

       }

     ],

     "setId": "aa1218cd-5356-4d83-9268-3f7eb9f5e8e4"

    }

    Example 3

    The example returns information about a user by the organization ID and the displayName filter parameter.

    Request:

    GET https://abc.tech.local:4443/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?displayName=Administrator

     

    Request Header:

    Authorization: Bearer <Access-Token>

     

    Response:

    200 OK

     

    Response Body:

    {

     "offset": 0,

     "limit": 30,

     "_links": {

       "self": {

         "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Users?displayname=Administrator&offset=0&limit=30&setid=c964d2d4-564a-427c-893e-dd5f607beaf9"

       }

     },

     "results": [

       {

         "id": "88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000",

         "displayName": "Administrator",

         "name": "administrator@abc.onmicrosoft.com",

         "type": "User",

         "locationType": "Cloud",

         "_links": {

           "self": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000"

           },

           "organization": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

           },

           "onedrives": {

             "href": "v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/users/88b14a1f-c0bd-435a-9d18-7c703ff1fb1400000000-0000-0000-0000-000000000000/onedrives"

           }

         }

       }

     ],

     "setId": "c964d2d4-564a-427c-893e-dd5f607beaf9"

    }