Update plannerTaskConfiguration
- 發行項
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 a plannerTaskConfiguration 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.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | BusinessScenarioConfig.ReadWrite.OwnedBy | BusinessScenarioConfig.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | BusinessScenarioConfig.ReadWrite.OwnedBy | Not available. |
HTTP request
PATCH /solutions/businessScenarios/{businessScenarioId}/planner/taskConfiguration
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json. Required. |
If-Match | Last known @odata-etag value for the plannerTaskConfiguration to be updated. Required. Learn more about etags. |
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 |
---|---|---|
editPolicy | plannerTaskPolicy | Policy configuration for tasks created for a businessScenario when they are being changed outside of the scenario. Optional. |
Response
If successful, this method returns a 200 OK
response code and an updated plannerTaskConfiguration object in the response body.
Examples
Request
The following example shows a request.
PATCH https://graph.microsoft.com/beta/solutions/businessScenarios/c5d514e6c6864911ac46c720affb6e4d/planner/taskConfiguration
Content-Type: application/json
If-Match: W/"JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="
{
"editPolicy": {
"rules": [
{
"userType": {
"@odata.type": "#microsoft.graph.plannerRelationshipBasedUserType",
"selectionKind": "relationship",
"role": "defaultRules"
},
"defaultRule": "block",
"propertyRule": {
"ruleKind": "taskRule",
"references": {
"defaultRules": [ "allow" ],
"overrides": []
},
"checkLists": {
"defaultRules": [ "allow" ],
"overrides": []
},
"assignments": {
"defaultRules": [ "allow" ],
"overrides": [
{
"name": "userCreated",
"rules": [ "allow" ]
},
{
"name": "applicationCreated",
"rules": [ "allow" ]
}
]
},
"appliedCategories": {
"defaultRules": [ "allow" ],
"overrides": []
}
}
}
]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PlannerTaskConfiguration
{
OdataType = "#microsoft.graph.plannerTaskConfiguration",
EditPolicy = new PlannerTaskPolicy
{
Rules = new List<PlannerTaskRoleBasedRule>
{
new PlannerTaskRoleBasedRule
{
DefaultRule = "block",
Role = new PlannerRelationshipBasedUserType
{
OdataType = "#microsoft.graph.plannerRelationshipBasedUserType",
RoleKind = PlannerUserRoleKind.Relationship,
Role = PlannerRelationshipUserRoles.DefaultRules,
},
PropertyRule = new PlannerTaskPropertyRule
{
PercentComplete = new List<string>
{
"allow",
},
RuleKind = PlannerRuleKind.TaskRule,
Assignments = new PlannerFieldRules
{
DefaultRules = new List<string>
{
"addSelf",
},
Overrides = new List<PlannerRuleOverride>
{
},
},
},
},
new PlannerTaskRoleBasedRule
{
DefaultRule = "block",
Role = new PlannerRelationshipBasedUserType
{
OdataType = "#microsoft.graph.plannerRelationshipBasedUserType",
RoleKind = PlannerUserRoleKind.Relationship,
Role = PlannerRelationshipUserRoles.TaskAssignees,
},
PropertyRule = new PlannerTaskPropertyRule
{
StartDate = new List<string>
{
"allow",
},
DueDate = new List<string>
{
"allow",
},
PercentComplete = new List<string>
{
"allow",
},
Order = new List<string>
{
"allow",
},
RuleKind = PlannerRuleKind.TaskRule,
References = new PlannerFieldRules
{
DefaultRules = new List<string>
{
"allow",
},
Overrides = new List<PlannerRuleOverride>
{
new PlannerRuleOverride
{
Name = "userCreated",
Rules = new List<string>
{
"allow",
},
},
new PlannerRuleOverride
{
Name = "applicationCreated",
Rules = new List<string>
{
"block",
},
},
},
},
CheckLists = new PlannerFieldRules
{
DefaultRules = new List<string>
{
"allow",
},
Overrides = new List<PlannerRuleOverride>
{
new PlannerRuleOverride
{
Name = "userCreated",
Rules = new List<string>
{
"allow",
},
},
new PlannerRuleOverride
{
Name = "applicationCreated",
Rules = new List<string>
{
"check",
},
},
},
},
Assignments = new PlannerFieldRules
{
DefaultRules = new List<string>
{
"block",
},
Overrides = new List<PlannerRuleOverride>
{
new PlannerRuleOverride
{
Name = "userCreated",
Rules = new List<string>
{
"removeSelf",
},
},
new PlannerRuleOverride
{
Name = "applicationCreated",
Rules = new List<string>
{
"check",
},
},
},
},
AppliedCategories = new PlannerFieldRules
{
DefaultRules = new List<string>
{
"allow",
},
Overrides = new List<PlannerRuleOverride>
{
},
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Solutions.BusinessScenarios["{businessScenario-id}"].Planner.TaskConfiguration.PatchAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc-beta solutions business-scenarios planner task-configuration patch --business-scenario-id {businessScenario-id} --body '{\
"@odata.type": "#microsoft.graph.plannerTaskConfiguration",\
"editPolicy": {\
"rules": [\
{\
"defaultRule": "block",\
"role": {\
"@odata.type": "#microsoft.graph.plannerRelationshipBasedUserType",\
"roleKind": "relationship",\
"role": "defaultRules"\
},\
"propertyRule": {\
"percentComplete": ["allow"],\
"ruleKind": "taskRule",\
"assignments": {\
"defaultRules": ["addSelf"],\
"overrides": []\
}\
}\
},\
{\
"defaultRule": "block",\
"role": {\
"@odata.type": "#microsoft.graph.plannerRelationshipBasedUserType",\
"roleKind": "relationship",\
"role": "taskAssignees"\
},\
"propertyRule": {\
"startDate": ["allow"],\
"dueDate": ["allow"],\
"percentComplete": ["allow"],\
"order": ["allow"],\
"ruleKind": "taskRule",\
"references": {\
"defaultRules": ["allow"],\
"overrides": [\
{\
"name": "userCreated",\
"rules": ["allow"]\
},\
{\
"name": "applicationCreated",\
"rules": ["block"]\
}\
]\
},\
"checkLists": {\
"defaultRules": ["allow"],\
"overrides": [\
{\
"name": "userCreated",\
"rules": ["allow"]\
},\
{\
"name": "applicationCreated",\
"rules": ["check"]\
}\
]\
},\
"assignments": {\
"defaultRules": ["block"],\
"overrides": [\
{\
"name": "userCreated",\
"rules": ["removeSelf"]\
},\
{\
"name": "applicationCreated",\
"rules": ["check"]\
}\
]\
},\
"appliedCategories": {\
"defaultRules": [\
"allow"\
],\
"overrides": []\
}\
}\
}\
]\
}\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
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 $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.NewPlannerTaskConfiguration()
editPolicy := graphmodels.NewPlannerTaskPolicy()
plannerTaskRoleBasedRule := graphmodels.NewPlannerTaskRoleBasedRule()
defaultRule := "block"
plannerTaskRoleBasedRule.SetDefaultRule(&defaultRule)
role := graphmodels.NewPlannerRelationshipBasedUserType()
roleKind := graphmodels.RELATIONSHIP_PLANNERUSERROLEKIND
role.SetRoleKind(&roleKind)
role := graphmodels.DEFAULTRULES_PLANNERRELATIONSHIPUSERROLES
role.SetRole(&role)
plannerTaskRoleBasedRule.SetRole(role)
propertyRule := graphmodels.NewPlannerTaskPropertyRule()
percentComplete := []string {
"allow",
}
propertyRule.SetPercentComplete(percentComplete)
ruleKind := graphmodels.TASKRULE_PLANNERRULEKIND
propertyRule.SetRuleKind(&ruleKind)
assignments := graphmodels.NewPlannerFieldRules()
defaultRules := []string {
"addSelf",
}
assignments.SetDefaultRules(defaultRules)
overrides := []graphmodels.PlannerRuleOverrideable {
}
assignments.SetOverrides(overrides)
propertyRule.SetAssignments(assignments)
plannerTaskRoleBasedRule.SetPropertyRule(propertyRule)
plannerTaskRoleBasedRule1 := graphmodels.NewPlannerTaskRoleBasedRule()
defaultRule := "block"
plannerTaskRoleBasedRule1.SetDefaultRule(&defaultRule)
role := graphmodels.NewPlannerRelationshipBasedUserType()
roleKind := graphmodels.RELATIONSHIP_PLANNERUSERROLEKIND
role.SetRoleKind(&roleKind)
role := graphmodels.TASKASSIGNEES_PLANNERRELATIONSHIPUSERROLES
role.SetRole(&role)
plannerTaskRoleBasedRule1.SetRole(role)
propertyRule := graphmodels.NewPlannerTaskPropertyRule()
startDate := []string {
"allow",
}
propertyRule.SetStartDate(startDate)
dueDate := []string {
"allow",
}
propertyRule.SetDueDate(dueDate)
percentComplete := []string {
"allow",
}
propertyRule.SetPercentComplete(percentComplete)
order := []string {
"allow",
}
propertyRule.SetOrder(order)
ruleKind := graphmodels.TASKRULE_PLANNERRULEKIND
propertyRule.SetRuleKind(&ruleKind)
references := graphmodels.NewPlannerFieldRules()
defaultRules := []string {
"allow",
}
references.SetDefaultRules(defaultRules)
plannerRuleOverride := graphmodels.NewPlannerRuleOverride()
name := "userCreated"
plannerRuleOverride.SetName(&name)
rules := []string {
"allow",
}
plannerRuleOverride.SetRules(rules)
plannerRuleOverride1 := graphmodels.NewPlannerRuleOverride()
name := "applicationCreated"
plannerRuleOverride1.SetName(&name)
rules := []string {
"block",
}
plannerRuleOverride1.SetRules(rules)
overrides := []graphmodels.PlannerRuleOverrideable {
plannerRuleOverride,
plannerRuleOverride1,
}
references.SetOverrides(overrides)
propertyRule.SetReferences(references)
checkLists := graphmodels.NewPlannerFieldRules()
defaultRules := []string {
"allow",
}
checkLists.SetDefaultRules(defaultRules)
plannerRuleOverride := graphmodels.NewPlannerRuleOverride()
name := "userCreated"
plannerRuleOverride.SetName(&name)
rules := []string {
"allow",
}
plannerRuleOverride.SetRules(rules)
plannerRuleOverride1 := graphmodels.NewPlannerRuleOverride()
name := "applicationCreated"
plannerRuleOverride1.SetName(&name)
rules := []string {
"check",
}
plannerRuleOverride1.SetRules(rules)
overrides := []graphmodels.PlannerRuleOverrideable {
plannerRuleOverride,
plannerRuleOverride1,
}
checkLists.SetOverrides(overrides)
propertyRule.SetCheckLists(checkLists)
assignments := graphmodels.NewPlannerFieldRules()
defaultRules := []string {
"block",
}
assignments.SetDefaultRules(defaultRules)
plannerRuleOverride := graphmodels.NewPlannerRuleOverride()
name := "userCreated"
plannerRuleOverride.SetName(&name)
rules := []string {
"removeSelf",
}
plannerRuleOverride.SetRules(rules)
plannerRuleOverride1 := graphmodels.NewPlannerRuleOverride()
name := "applicationCreated"
plannerRuleOverride1.SetName(&name)
rules := []string {
"check",
}
plannerRuleOverride1.SetRules(rules)
overrides := []graphmodels.PlannerRuleOverrideable {
plannerRuleOverride,
plannerRuleOverride1,
}
assignments.SetOverrides(overrides)
propertyRule.SetAssignments(assignments)
appliedCategories := graphmodels.NewPlannerFieldRules()
defaultRules := []string {
"allow",
}
appliedCategories.SetDefaultRules(defaultRules)
overrides := []graphmodels.PlannerRuleOverrideable {
}
appliedCategories.SetOverrides(overrides)
propertyRule.SetAppliedCategories(appliedCategories)
plannerTaskRoleBasedRule1.SetPropertyRule(propertyRule)
rules := []graphmodels.PlannerTaskRoleBasedRuleable {
plannerTaskRoleBasedRule,
plannerTaskRoleBasedRule1,
}
editPolicy.SetRules(rules)
requestBody.SetEditPolicy(editPolicy)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
taskConfiguration, err := graphClient.Solutions().BusinessScenarios().ByBusinessScenarioId("businessScenario-id").Planner().TaskConfiguration().Patch(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
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);
PlannerTaskConfiguration plannerTaskConfiguration = new PlannerTaskConfiguration();
plannerTaskConfiguration.setOdataType("#microsoft.graph.plannerTaskConfiguration");
PlannerTaskPolicy editPolicy = new PlannerTaskPolicy();
LinkedList<PlannerTaskRoleBasedRule> rules = new LinkedList<PlannerTaskRoleBasedRule>();
PlannerTaskRoleBasedRule plannerTaskRoleBasedRule = new PlannerTaskRoleBasedRule();
plannerTaskRoleBasedRule.setDefaultRule("block");
PlannerRelationshipBasedUserType role = new PlannerRelationshipBasedUserType();
role.setOdataType("#microsoft.graph.plannerRelationshipBasedUserType");
role.setRoleKind(PlannerUserRoleKind.Relationship);
role.setRole(PlannerRelationshipUserRoles.DefaultRules);
plannerTaskRoleBasedRule.setRole(role);
PlannerTaskPropertyRule propertyRule = new PlannerTaskPropertyRule();
LinkedList<String> percentComplete = new LinkedList<String>();
percentComplete.add("allow");
propertyRule.setPercentComplete(percentComplete);
propertyRule.setRuleKind(PlannerRuleKind.TaskRule);
PlannerFieldRules assignments = new PlannerFieldRules();
LinkedList<String> defaultRules = new LinkedList<String>();
defaultRules.add("addSelf");
assignments.setDefaultRules(defaultRules);
LinkedList<PlannerRuleOverride> overrides = new LinkedList<PlannerRuleOverride>();
assignments.setOverrides(overrides);
propertyRule.setAssignments(assignments);
plannerTaskRoleBasedRule.setPropertyRule(propertyRule);
rules.add(plannerTaskRoleBasedRule);
PlannerTaskRoleBasedRule plannerTaskRoleBasedRule1 = new PlannerTaskRoleBasedRule();
plannerTaskRoleBasedRule1.setDefaultRule("block");
PlannerRelationshipBasedUserType role2 = new PlannerRelationshipBasedUserType();
role2.setOdataType("#microsoft.graph.plannerRelationshipBasedUserType");
role2.setRoleKind(PlannerUserRoleKind.Relationship);
role2.setRole(PlannerRelationshipUserRoles.TaskAssignees);
plannerTaskRoleBasedRule1.setRole(role2);
PlannerTaskPropertyRule propertyRule1 = new PlannerTaskPropertyRule();
LinkedList<String> startDate = new LinkedList<String>();
startDate.add("allow");
propertyRule1.setStartDate(startDate);
LinkedList<String> dueDate = new LinkedList<String>();
dueDate.add("allow");
propertyRule1.setDueDate(dueDate);
LinkedList<String> percentComplete1 = new LinkedList<String>();
percentComplete1.add("allow");
propertyRule1.setPercentComplete(percentComplete1);
LinkedList<String> order = new LinkedList<String>();
order.add("allow");
propertyRule1.setOrder(order);
propertyRule1.setRuleKind(PlannerRuleKind.TaskRule);
PlannerFieldRules references = new PlannerFieldRules();
LinkedList<String> defaultRules1 = new LinkedList<String>();
defaultRules1.add("allow");
references.setDefaultRules(defaultRules1);
LinkedList<PlannerRuleOverride> overrides1 = new LinkedList<PlannerRuleOverride>();
PlannerRuleOverride plannerRuleOverride = new PlannerRuleOverride();
plannerRuleOverride.setName("userCreated");
LinkedList<String> rules1 = new LinkedList<String>();
rules1.add("allow");
plannerRuleOverride.setRules(rules1);
overrides1.add(plannerRuleOverride);
PlannerRuleOverride plannerRuleOverride1 = new PlannerRuleOverride();
plannerRuleOverride1.setName("applicationCreated");
LinkedList<String> rules2 = new LinkedList<String>();
rules2.add("block");
plannerRuleOverride1.setRules(rules2);
overrides1.add(plannerRuleOverride1);
references.setOverrides(overrides1);
propertyRule1.setReferences(references);
PlannerFieldRules checkLists = new PlannerFieldRules();
LinkedList<String> defaultRules2 = new LinkedList<String>();
defaultRules2.add("allow");
checkLists.setDefaultRules(defaultRules2);
LinkedList<PlannerRuleOverride> overrides2 = new LinkedList<PlannerRuleOverride>();
PlannerRuleOverride plannerRuleOverride2 = new PlannerRuleOverride();
plannerRuleOverride2.setName("userCreated");
LinkedList<String> rules3 = new LinkedList<String>();
rules3.add("allow");
plannerRuleOverride2.setRules(rules3);
overrides2.add(plannerRuleOverride2);
PlannerRuleOverride plannerRuleOverride3 = new PlannerRuleOverride();
plannerRuleOverride3.setName("applicationCreated");
LinkedList<String> rules4 = new LinkedList<String>();
rules4.add("check");
plannerRuleOverride3.setRules(rules4);
overrides2.add(plannerRuleOverride3);
checkLists.setOverrides(overrides2);
propertyRule1.setCheckLists(checkLists);
PlannerFieldRules assignments1 = new PlannerFieldRules();
LinkedList<String> defaultRules3 = new LinkedList<String>();
defaultRules3.add("block");
assignments1.setDefaultRules(defaultRules3);
LinkedList<PlannerRuleOverride> overrides3 = new LinkedList<PlannerRuleOverride>();
PlannerRuleOverride plannerRuleOverride4 = new PlannerRuleOverride();
plannerRuleOverride4.setName("userCreated");
LinkedList<String> rules5 = new LinkedList<String>();
rules5.add("removeSelf");
plannerRuleOverride4.setRules(rules5);
overrides3.add(plannerRuleOverride4);
PlannerRuleOverride plannerRuleOverride5 = new PlannerRuleOverride();
plannerRuleOverride5.setName("applicationCreated");
LinkedList<String> rules6 = new LinkedList<String>();
rules6.add("check");
plannerRuleOverride5.setRules(rules6);
overrides3.add(plannerRuleOverride5);
assignments1.setOverrides(overrides3);
propertyRule1.setAssignments(assignments1);
PlannerFieldRules appliedCategories = new PlannerFieldRules();
LinkedList<String> defaultRules4 = new LinkedList<String>();
defaultRules4.add("allow");
appliedCategories.setDefaultRules(defaultRules4);
LinkedList<PlannerRuleOverride> overrides4 = new LinkedList<PlannerRuleOverride>();
appliedCategories.setOverrides(overrides4);
propertyRule1.setAppliedCategories(appliedCategories);
plannerTaskRoleBasedRule1.setPropertyRule(propertyRule1);
rules.add(plannerTaskRoleBasedRule1);
editPolicy.setRules(rules);
plannerTaskConfiguration.setEditPolicy(editPolicy);
PlannerTaskConfiguration result = graphClient.solutions().businessScenarios().byBusinessScenarioId("{businessScenario-id}").planner().taskConfiguration().patch(plannerTaskConfiguration);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
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 plannerTaskConfiguration = {
'@odata.type': '#microsoft.graph.plannerTaskConfiguration',
editPolicy: {
rules: [
{
defaultRule: 'block',
role: {
'@odata.type': '#microsoft.graph.plannerRelationshipBasedUserType',
roleKind: 'relationship',
role: 'defaultRules'
},
propertyRule: {
percentComplete: ['allow'],
ruleKind: 'taskRule',
assignments: {
defaultRules: ['addSelf'],
overrides: []
}
}
},
{
defaultRule: 'block',
role: {
'@odata.type': '#microsoft.graph.plannerRelationshipBasedUserType',
roleKind: 'relationship',
role: 'taskAssignees'
},
propertyRule: {
startDate: ['allow'],
dueDate: ['allow'],
percentComplete: ['allow'],
order: ['allow'],
ruleKind: 'taskRule',
references: {
defaultRules: ['allow'],
overrides: [
{
name: 'userCreated',
rules: ['allow']
},
{
name: 'applicationCreated',
rules: ['block']
}
]
},
checkLists: {
defaultRules: ['allow'],
overrides: [
{
name: 'userCreated',
rules: ['allow']
},
{
name: 'applicationCreated',
rules: ['check']
}
]
},
assignments: {
defaultRules: ['block'],
overrides: [
{
name: 'userCreated',
rules: ['removeSelf']
},
{
name: 'applicationCreated',
rules: ['check']
}
]
},
appliedCategories: {
defaultRules: [
'allow'
],
overrides: []
}
}
}
]
}
};
await client.api('/solutions/businessScenarios/c5d514e6c6864911ac46c720affb6e4d/planner/taskConfiguration')
.version('beta')
.update(plannerTaskConfiguration);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\PlannerTaskConfiguration;
use Microsoft\Graph\Beta\Generated\Models\PlannerTaskPolicy;
use Microsoft\Graph\Beta\Generated\Models\PlannerTaskRoleBasedRule;
use Microsoft\Graph\Beta\Generated\Models\PlannerRelationshipBasedUserType;
use Microsoft\Graph\Beta\Generated\Models\PlannerUserRoleKind;
use Microsoft\Graph\Beta\Generated\Models\PlannerRelationshipUserRoles;
use Microsoft\Graph\Beta\Generated\Models\PlannerTaskPropertyRule;
use Microsoft\Graph\Beta\Generated\Models\PlannerRuleKind;
use Microsoft\Graph\Beta\Generated\Models\PlannerFieldRules;
use Microsoft\Graph\Beta\Generated\Models\PlannerRuleOverride;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PlannerTaskConfiguration();
$requestBody->setOdataType('#microsoft.graph.plannerTaskConfiguration');
$editPolicy = new PlannerTaskPolicy();
$rulesPlannerTaskRoleBasedRule1 = new PlannerTaskRoleBasedRule();
$rulesPlannerTaskRoleBasedRule1->setDefaultRule('block');
$rulesPlannerTaskRoleBasedRule1Role = new PlannerRelationshipBasedUserType();
$rulesPlannerTaskRoleBasedRule1Role->setOdataType('#microsoft.graph.plannerRelationshipBasedUserType');
$rulesPlannerTaskRoleBasedRule1Role->setRoleKind(new PlannerUserRoleKind('relationship'));
$rulesPlannerTaskRoleBasedRule1Role->setRole(new PlannerRelationshipUserRoles('defaultRules'));
$rulesPlannerTaskRoleBasedRule1->setRole($rulesPlannerTaskRoleBasedRule1Role);
$rulesPlannerTaskRoleBasedRule1PropertyRule = new PlannerTaskPropertyRule();
$rulesPlannerTaskRoleBasedRule1PropertyRule->setPercentComplete(['allow', ]);
$rulesPlannerTaskRoleBasedRule1PropertyRule->setRuleKind(new PlannerRuleKind('taskRule'));
$rulesPlannerTaskRoleBasedRule1PropertyRuleAssignments = new PlannerFieldRules();
$rulesPlannerTaskRoleBasedRule1PropertyRuleAssignments->setDefaultRules(['addSelf', ]);
$rulesPlannerTaskRoleBasedRule1PropertyRuleAssignments->setOverrides([ ]);
$rulesPlannerTaskRoleBasedRule1PropertyRule->setAssignments($rulesPlannerTaskRoleBasedRule1PropertyRuleAssignments);
$rulesPlannerTaskRoleBasedRule1->setPropertyRule($rulesPlannerTaskRoleBasedRule1PropertyRule);
$rulesArray []= $rulesPlannerTaskRoleBasedRule1;
$rulesPlannerTaskRoleBasedRule2 = new PlannerTaskRoleBasedRule();
$rulesPlannerTaskRoleBasedRule2->setDefaultRule('block');
$rulesPlannerTaskRoleBasedRule2Role = new PlannerRelationshipBasedUserType();
$rulesPlannerTaskRoleBasedRule2Role->setOdataType('#microsoft.graph.plannerRelationshipBasedUserType');
$rulesPlannerTaskRoleBasedRule2Role->setRoleKind(new PlannerUserRoleKind('relationship'));
$rulesPlannerTaskRoleBasedRule2Role->setRole(new PlannerRelationshipUserRoles('taskAssignees'));
$rulesPlannerTaskRoleBasedRule2->setRole($rulesPlannerTaskRoleBasedRule2Role);
$rulesPlannerTaskRoleBasedRule2PropertyRule = new PlannerTaskPropertyRule();
$rulesPlannerTaskRoleBasedRule2PropertyRule->setStartDate(['allow', ]);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setDueDate(['allow', ]);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setPercentComplete(['allow', ]);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setOrder(['allow', ]);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setRuleKind(new PlannerRuleKind('taskRule'));
$rulesPlannerTaskRoleBasedRule2PropertyRuleReferences = new PlannerFieldRules();
$rulesPlannerTaskRoleBasedRule2PropertyRuleReferences->setDefaultRules(['allow', ]);
$overridesPlannerRuleOverride1 = new PlannerRuleOverride();
$overridesPlannerRuleOverride1->setName('userCreated');
$overridesPlannerRuleOverride1->setRules(['allow', ]);
$overridesArray []= $overridesPlannerRuleOverride1;
$overridesPlannerRuleOverride2 = new PlannerRuleOverride();
$overridesPlannerRuleOverride2->setName('applicationCreated');
$overridesPlannerRuleOverride2->setRules(['block', ]);
$overridesArray []= $overridesPlannerRuleOverride2;
$rulesPlannerTaskRoleBasedRule2PropertyRuleReferences->setOverrides($overridesArray);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setReferences($rulesPlannerTaskRoleBasedRule2PropertyRuleReferences);
$rulesPlannerTaskRoleBasedRule2PropertyRuleCheckLists = new PlannerFieldRules();
$rulesPlannerTaskRoleBasedRule2PropertyRuleCheckLists->setDefaultRules(['allow', ]);
$overridesPlannerRuleOverride1 = new PlannerRuleOverride();
$overridesPlannerRuleOverride1->setName('userCreated');
$overridesPlannerRuleOverride1->setRules(['allow', ]);
$overridesArray []= $overridesPlannerRuleOverride1;
$overridesPlannerRuleOverride2 = new PlannerRuleOverride();
$overridesPlannerRuleOverride2->setName('applicationCreated');
$overridesPlannerRuleOverride2->setRules(['check', ]);
$overridesArray []= $overridesPlannerRuleOverride2;
$rulesPlannerTaskRoleBasedRule2PropertyRuleCheckLists->setOverrides($overridesArray);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setCheckLists($rulesPlannerTaskRoleBasedRule2PropertyRuleCheckLists);
$rulesPlannerTaskRoleBasedRule2PropertyRuleAssignments = new PlannerFieldRules();
$rulesPlannerTaskRoleBasedRule2PropertyRuleAssignments->setDefaultRules(['block', ]);
$overridesPlannerRuleOverride1 = new PlannerRuleOverride();
$overridesPlannerRuleOverride1->setName('userCreated');
$overridesPlannerRuleOverride1->setRules(['removeSelf', ]);
$overridesArray []= $overridesPlannerRuleOverride1;
$overridesPlannerRuleOverride2 = new PlannerRuleOverride();
$overridesPlannerRuleOverride2->setName('applicationCreated');
$overridesPlannerRuleOverride2->setRules(['check', ]);
$overridesArray []= $overridesPlannerRuleOverride2;
$rulesPlannerTaskRoleBasedRule2PropertyRuleAssignments->setOverrides($overridesArray);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setAssignments($rulesPlannerTaskRoleBasedRule2PropertyRuleAssignments);
$rulesPlannerTaskRoleBasedRule2PropertyRuleAppliedCategories = new PlannerFieldRules();
$rulesPlannerTaskRoleBasedRule2PropertyRuleAppliedCategories->setDefaultRules(['allow', ]);
$rulesPlannerTaskRoleBasedRule2PropertyRuleAppliedCategories->setOverrides([]);
$rulesPlannerTaskRoleBasedRule2PropertyRule->setAppliedCategories($rulesPlannerTaskRoleBasedRule2PropertyRuleAppliedCategories);
$rulesPlannerTaskRoleBasedRule2->setPropertyRule($rulesPlannerTaskRoleBasedRule2PropertyRule);
$rulesArray []= $rulesPlannerTaskRoleBasedRule2;
$editPolicy->setRules($rulesArray);
$requestBody->setEditPolicy($editPolicy);
$result = $graphServiceClient->solutions()->businessScenarios()->byBusinessScenarioId('businessScenario-id')->planner()->taskConfiguration()->patch($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Beta.BusinessScenario
$params = @{
"@odata.type" = "#microsoft.graph.plannerTaskConfiguration"
editPolicy = @{
rules = @(
@{
defaultRule = "block"
role = @{
"@odata.type" = "#microsoft.graph.plannerRelationshipBasedUserType"
roleKind = "relationship"
role = "defaultRules"
}
propertyRule = @{
percentComplete = @(
"allow"
)
ruleKind = "taskRule"
assignments = @{
defaultRules = @(
"addSelf"
)
overrides = @(
)
}
}
}
@{
defaultRule = "block"
role = @{
"@odata.type" = "#microsoft.graph.plannerRelationshipBasedUserType"
roleKind = "relationship"
role = "taskAssignees"
}
propertyRule = @{
startDate = @(
"allow"
)
dueDate = @(
"allow"
)
percentComplete = @(
"allow"
)
order = @(
"allow"
)
ruleKind = "taskRule"
references = @{
defaultRules = @(
"allow"
)
overrides = @(
@{
name = "userCreated"
rules = @(
"allow"
)
}
@{
name = "applicationCreated"
rules = @(
"block"
)
}
)
}
checkLists = @{
defaultRules = @(
"allow"
)
overrides = @(
@{
name = "userCreated"
rules = @(
"allow"
)
}
@{
name = "applicationCreated"
rules = @(
"check"
)
}
)
}
assignments = @{
defaultRules = @(
"block"
)
overrides = @(
@{
name = "userCreated"
rules = @(
"removeSelf"
)
}
@{
name = "applicationCreated"
rules = @(
"check"
)
}
)
}
appliedCategories = @{
defaultRules = @(
"allow"
)
overrides = @(
)
}
}
}
)
}
}
Update-MgBetaSolutionBusinessScenarioPlannerTaskConfiguration -BusinessScenarioId $businessScenarioId -BodyParameter $params
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
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_beta import GraphServiceClient
from msgraph_beta.generated.models.planner_task_configuration import PlannerTaskConfiguration
from msgraph_beta.generated.models.planner_task_policy import PlannerTaskPolicy
from msgraph_beta.generated.models.planner_task_role_based_rule import PlannerTaskRoleBasedRule
from msgraph_beta.generated.models.planner_relationship_based_user_type import PlannerRelationshipBasedUserType
from msgraph_beta.generated.models.planner_user_role_kind import PlannerUserRoleKind
from msgraph_beta.generated.models.planner_relationship_user_roles import PlannerRelationshipUserRoles
from msgraph_beta.generated.models.planner_task_property_rule import PlannerTaskPropertyRule
from msgraph_beta.generated.models.planner_rule_kind import PlannerRuleKind
from msgraph_beta.generated.models.planner_field_rules import PlannerFieldRules
from msgraph_beta.generated.models.planner_rule_override import PlannerRuleOverride
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PlannerTaskConfiguration(
odata_type = "#microsoft.graph.plannerTaskConfiguration",
edit_policy = PlannerTaskPolicy(
rules = [
PlannerTaskRoleBasedRule(
default_rule = "block",
role = PlannerRelationshipBasedUserType(
odata_type = "#microsoft.graph.plannerRelationshipBasedUserType",
role_kind = PlannerUserRoleKind.Relationship,
role = PlannerRelationshipUserRoles.DefaultRules,
),
property_rule = PlannerTaskPropertyRule(
percent_complete = [
"allow",
],
rule_kind = PlannerRuleKind.TaskRule,
assignments = PlannerFieldRules(
default_rules = [
"addSelf",
],
overrides = [
],
),
),
),
PlannerTaskRoleBasedRule(
default_rule = "block",
role = PlannerRelationshipBasedUserType(
odata_type = "#microsoft.graph.plannerRelationshipBasedUserType",
role_kind = PlannerUserRoleKind.Relationship,
role = PlannerRelationshipUserRoles.TaskAssignees,
),
property_rule = PlannerTaskPropertyRule(
start_date = [
"allow",
],
due_date = [
"allow",
],
percent_complete = [
"allow",
],
order = [
"allow",
],
rule_kind = PlannerRuleKind.TaskRule,
references = PlannerFieldRules(
default_rules = [
"allow",
],
overrides = [
PlannerRuleOverride(
name = "userCreated",
rules = [
"allow",
],
),
PlannerRuleOverride(
name = "applicationCreated",
rules = [
"block",
],
),
],
),
check_lists = PlannerFieldRules(
default_rules = [
"allow",
],
overrides = [
PlannerRuleOverride(
name = "userCreated",
rules = [
"allow",
],
),
PlannerRuleOverride(
name = "applicationCreated",
rules = [
"check",
],
),
],
),
assignments = PlannerFieldRules(
default_rules = [
"block",
],
overrides = [
PlannerRuleOverride(
name = "userCreated",
rules = [
"removeSelf",
],
),
PlannerRuleOverride(
name = "applicationCreated",
rules = [
"check",
],
),
],
),
applied_categories = PlannerFieldRules(
default_rules = [
"allow",
],
overrides = [
],
),
),
),
],
),
)
result = await graph_client.solutions.business_scenarios.by_business_scenario_id('businessScenario-id').planner.task_configuration.patch(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
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.
HTTP/1.1 204 No Content
意見反應
此頁面對您有幫助嗎?