Namespace: microsoft.graph
Get the directory objects that a user sponsors. Sponsored objects can include users, agent users, agent blueprints, agent blueprint principals, and agent identities. Because a group can also be a sponsor, the response includes both objects the user directly sponsors and objects the user sponsors through group membership.
This API is available in the following national cloud deployments.
| Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
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.
| Permission type |
Least privileged permissions |
Higher privileged permissions |
| Delegated (work or school account) |
User.Read |
User.Read.All, User.ReadWrite.All |
| Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
| Application |
Not supported. |
Not supported. |
HTTP request
GET /me/sponsorOf
GET /users/{id | userPrincipalName}/sponsorOf
Optional query parameters
This method supports the $filter, $count, $select, $expand, $top, and $skip OData query parameters to help customize the response.
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK response code and a collection of directoryObject objects in the response body.
Examples
Request
The following example shows a request.
GET https://graph.microsoft.com/v1.0/users/025e5e3e-e5b7-4eb4-ba1f-4e5b0579f1a2/sponsorOf
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].SponsorOf.GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sponsorOf, err := graphClient.Users().ByUserId("user-id").SponsorOf().Get(context.Background(), nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryObjectCollectionResponse result = graphClient.users().byUserId("{user-id}").sponsorOf().get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
let sponsorOf = await client.api('/users/025e5e3e-e5b7-4eb4-ba1f-4e5b0579f1a2/sponsorOf')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->users()->byUserId('user-id')->sponsorOf()->get()->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.users.by_user_id('user-id').sponsor_of.get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"displayName": "Guest User 1",
"userPrincipalName": "guestuser1_example.com#EXT#@contoso.onmicrosoft.com",
"userType": "Guest"
},
{
"@odata.type": "#microsoft.graph.user",
"id": "2fe96d23-5dc6-4f35-8222-0426a8c115c6",
"displayName": "Guest User 2",
"userPrincipalName": "guestuser2_example.com#EXT#@contoso.onmicrosoft.com",
"userType": "Guest"
}
]
}
Request
The following example shows a request that filters the sponsored objects by user type.
GET https://graph.microsoft.com/v1.0/users/025e5e3e-e5b7-4eb4-ba1f-4e5b0579f1a2/sponsorOf?$filter=microsoft.graph.user/userType eq 'Guest'
ConsistencyLevel: eventual
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].SponsorOf.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "microsoft.graph.user/userType eq 'Guest'";
requestConfiguration.Headers.Add("ConsistencyLevel", "eventual");
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
abstractions "github.com/microsoft/kiota-abstractions-go"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
//other-imports
)
headers := abstractions.NewRequestHeaders()
headers.Add("ConsistencyLevel", "eventual")
requestFilter := "microsoft.graph.user/userType eq 'Guest'"
requestParameters := &graphusers.ItemSponsorOfRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphusers.ItemSponsorOfRequestBuilderGetRequestConfiguration{
Headers: headers,
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sponsorOf, err := graphClient.Users().ByUserId("user-id").SponsorOf().Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DirectoryObjectCollectionResponse result = graphClient.users().byUserId("{user-id}").sponsorOf().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "microsoft.graph.user/userType eq 'Guest'";
requestConfiguration.headers.add("ConsistencyLevel", "eventual");
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
let sponsorOf = await client.api('/users/025e5e3e-e5b7-4eb4-ba1f-4e5b0579f1a2/sponsorOf')
.header('ConsistencyLevel','eventual')
.filter('microsoft.graph.user/userType eq \'Guest\'')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\SponsorOf\SponsorOfRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new SponsorOfRequestBuilderGetRequestConfiguration();
$headers = [
'ConsistencyLevel' => 'eventual',
];
$requestConfiguration->headers = $headers;
$queryParameters = SponsorOfRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "microsoft.graph.user/userType eq 'Guest'";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->users()->byUserId('user-id')->sponsorOf()->get($requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.users.item.sponsor_of.sponsor_of_request_builder import SponsorOfRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = SponsorOfRequestBuilder.SponsorOfRequestBuilderGetQueryParameters(
filter = "microsoft.graph.user/userType eq 'Guest'",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
request_configuration.headers.add("ConsistencyLevel", "eventual")
result = await graph_client.users.by_user_id('user-id').sponsor_of.get(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"displayName": "Guest User 1",
"userPrincipalName": "guestuser1_example.com#EXT#@contoso.onmicrosoft.com",
"userType": "Guest"
}
]
}