Namespace: microsoft.graph
Important
APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Update the properties of an onPremisesSyncBehavior object.
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.
| Supported resource |
Delegated (work or school account) |
Delegated (personal Microsoft account) |
Application |
| group |
Group-OnPremisesSyncBehavior.ReadWrite.All |
Not supported. |
Group-OnPremisesSyncBehavior.ReadWrite.All |
| orgContact |
Contacts-OnPremisesSyncBehavior.ReadWrite.All |
Not supported. |
Contacts-OnPremisesSyncBehavior.ReadWrite.All |
| user |
User-OnPremisesSyncBehavior.ReadWrite.All |
Not supported. |
User-OnPremisesSyncBehavior.ReadWrite.All |
Important
In delegated scenarios with work or school accounts, the signed-in user must be assigned a supported Microsoft Entra role or a custom role with a supported role permission. Hybrid Administrator is the least privileged role supported for this operation.
HTTP request
PATCH /contacts/{id}/onPremisesSyncBehavior
PATCH /groups/{id}/onPremisesSyncBehavior
PATCH /users/{id}/onPremisesSyncBehavior
Request body
In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.
The following table specifies the properties that can be updated.
| Property |
Type |
Description |
| isCloudManaged |
Boolean |
Indicates whether the object’s source of authority is set to the cloud. If true, updates from on-premises Active Directory are blocked in the cloud; if false, updates from on-premises Active Directory are allowed in the cloud and object can be taken over by the on-premises Active Directory. |
Response
If successful, this method returns a 204 No Content response code.
Examples
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/groups/e7c2f02a-7a59-40de-8d6e-1e0197b8cfba/onPremisesSyncBehavior
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.onPremisesSyncBehavior",
"isCloudManaged": true
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OnPremisesSyncBehavior
{
OdataType = "#microsoft.graph.onPremisesSyncBehavior",
IsCloudManaged = true,
};
// To initialize your graphClient, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Groups["{group-id}"].OnPremisesSyncBehavior.PatchAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewOnPremisesSyncBehavior()
isCloudManaged := true
requestBody.SetIsCloudManaged(&isCloudManaged)
// To initialize your graphClient, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=go
onPremisesSyncBehavior, err := graphClient.Groups().ByGroupId("group-id").OnPremisesSyncBehavior().Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnPremisesSyncBehavior onPremisesSyncBehavior = new OnPremisesSyncBehavior();
onPremisesSyncBehavior.setOdataType("#microsoft.graph.onPremisesSyncBehavior");
onPremisesSyncBehavior.setIsCloudManaged(true);
OnPremisesSyncBehavior result = graphClient.groups().byGroupId("{group-id}").onPremisesSyncBehavior().patch(onPremisesSyncBehavior);
const options = {
authProvider,
};
const client = Client.init(options);
const onPremisesSyncBehavior = {
'@odata.type': '#microsoft.graph.onPremisesSyncBehavior',
isCloudManaged: true
};
await client.api('/groups/e7c2f02a-7a59-40de-8d6e-1e0197b8cfba/onPremisesSyncBehavior')
.version('beta')
.update(onPremisesSyncBehavior);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\OnPremisesSyncBehavior;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnPremisesSyncBehavior();
$requestBody->setOdataType('#microsoft.graph.onPremisesSyncBehavior');
$requestBody->setIsCloudManaged(true);
$result = $graphServiceClient->groups()->byGroupId('group-id')->onPremisesSyncBehavior()->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Groups
$params = @{
"@odata.type" = "#microsoft.graph.onPremisesSyncBehavior"
isCloudManaged = $true
}
Update-MgBetaGroupOnPremiseSyncBehavior -GroupId $groupId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.on_premises_sync_behavior import OnPremisesSyncBehavior
# To initialize your graph_client, see https://dotnet.territoriali.olinfo.it/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnPremisesSyncBehavior(
odata_type = "#microsoft.graph.onPremisesSyncBehavior",
is_cloud_managed = True,
)
result = await graph_client.groups.by_group_id('group-id').on_premises_sync_behavior.patch(request_body)
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 204 No Content