Create activityBasedTimeoutPolicy
Article
09/27/2023
7 contributors
Feedback
In this article
Namespace: microsoft.graph
Create a new activityBasedTimeoutPolicy object.
This API is supported in the following national cloud deployments .
Global service
US Government L4
US Government L5 (DOD)
China operated by 21Vianet
✅
✅
✅
✅
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Policy.ReadWrite.ApplicationConfiguration
Delegated (personal Microsoft account)
Not supported.
Application
Policy.ReadWrite.ApplicationConfiguration
HTTP request
POST policies/activityBasedTimeoutPolicies
Name
Description
Authorization
Bearer {token}. Required.
Content-type
application/json. Required.
Request body
In the request body, supply a JSON representation of an activityBasedTimeoutPolicy object.
Response
If successful, this method returns a 201 Created
response code and a new activityBasedTimeoutPolicy object in the response body.
Examples
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/policies/activityBasedTimeoutPolicies
Content-type: application/json
{
"definition": [
"definition-value"
],
"displayName": "displayName-value",
"isOrganizationDefault": true
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new ActivityBasedTimeoutPolicy
{
Definition = new List<string>
{
"definition-value",
},
DisplayName = "displayName-value",
IsOrganizationDefault = true,
};
var result = await graphClient.Policies.ActivityBasedTimeoutPolicies.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc policies activity-based-timeout-policies create --body '{\
"definition": [\
"definition-value"\
],\
"displayName": "displayName-value",\
"isOrganizationDefault": true\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewActivityBasedTimeoutPolicy()
definition := []string {
"definition-value",
}
requestBody.SetDefinition(definition)
displayName := "displayName-value"
requestBody.SetDisplayName(&displayName)
isOrganizationDefault := true
requestBody.SetIsOrganizationDefault(&isOrganizationDefault)
activityBasedTimeoutPolicies, err := graphClient.Policies().ActivityBasedTimeoutPolicies().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
ActivityBasedTimeoutPolicy activityBasedTimeoutPolicy = new ActivityBasedTimeoutPolicy();
LinkedList<String> definitionList = new LinkedList<String>();
definitionList.add("definition-value");
activityBasedTimeoutPolicy.definition = definitionList;
activityBasedTimeoutPolicy.displayName = "displayName-value";
activityBasedTimeoutPolicy.isOrganizationDefault = true;
graphClient.policies().activityBasedTimeoutPolicies()
.buildRequest()
.post(activityBasedTimeoutPolicy);
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);
const activityBasedTimeoutPolicy = {
definition: [
'definition-value'
],
displayName: 'displayName-value',
isOrganizationDefault: true
};
await client.api('/policies/activityBasedTimeoutPolicies')
.post(activityBasedTimeoutPolicy);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ActivityBasedTimeoutPolicy();
$requestBody->setDefinition(['definition-value', ]);
$requestBody->setDisplayName('displayName-value');
$requestBody->setIsOrganizationDefault(true);
$result = $graphServiceClient->policies()->activityBasedTimeoutPolicies()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Identity.SignIns
$params = @{
definition = @(
"definition-value"
)
displayName = "displayName-value"
isOrganizationDefault = $true
}
New-MgPolicyActivityBasedTimeoutPolicy -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
request_body = ActivityBasedTimeoutPolicy(
definition = [
"definition-value",
]
display_name = "displayName-value",
is_organization_default = True,
)
result = await graph_client.policies.activity_based_timeout_policies.post(body = request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"definition": [
"definition-value"
],
"displayName": "displayName-value",
"isOrganizationDefault": true,
"id": "id-value"
}