Skip to content

Latest commit

 

History

History
167 lines (122 loc) · 5.59 KB

File metadata and controls

167 lines (122 loc) · 5.59 KB
title Add sponsor
description Assign a user a sponsor.
author sadia353
ms.localizationpriority medium
ms.subservice entra-users
doc_type apiPageType
ms.date 10/15/2024

Add sponsor

Namespace: microsoft.graph

Assign a user a sponsor. Sponsors are users and groups that are responsible for this guest user's privileges in the tenant and for keeping the guest user's information and access up to date.

[!INCLUDE national-cloud-support]

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

[!INCLUDE permissions-table]

[!INCLUDE rbac-user-sponsors-apis-write]

HTTP request

POST /users/{id}/sponsors/$ref

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON object and pass an @odata.id parameter with the read URL of the user or group object to be added.

Response

If successful, this method returns 204 No Content response code. It doesn't return anything in the response body.

Examples

Example 1: Assign a user as a sponsor

Request

The following example shows a request. The request body is a JSON object with an @odata.id parameter and the read URL for the user object to be assigned as a sponsor.

POST https://graph.microsoft.com/v1.0/users/d8ab5060-f636-4cff-ae97-d4687f5c83f3/sponsors/$ref
Content-Type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/users/{user-id}"
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

HTTP/1.1 204 No Content

Example 2: Assign a group as a sponsor

Request

The following example shows a request. The request body is a JSON object with an @odata.id parameter and the read URL for the group object to be assigned as a sponsor.

POST https://graph.microsoft.com/v1.0/users/d8ab5060-f636-4cff-ae97-d4687f5c83f3/sponsors/$ref
Content-Type: application/json

{
  "@odata.id": "https://graph.microsoft.com/v1.0/groups/{group-id}"
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

HTTP/1.1 204 No Content