在请求正文中,提供应更新的相关字段的值。 请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。 为了实现最佳性能,不得添加未变化的现有值。
PATCH https://graph.microsoft.com/beta/organization/84841066-274d-4ec0-a5c1-276be684bdd3
Content-type: application/json
{
"marketingNotificationEmails" : ["marketing@contoso.com"],
"onPremisesSyncEnabled" : true,
"privacyProfile" :
{
"contactEmail":"alice@contoso.com",
"statementUrl":"https://contoso.com/privacyStatement"
},
"securityComplianceNotificationMails" : ["security@contoso.com"],
"securityComplianceNotificationPhones" : ["(123) 456-7890"],
"technicalNotificationMails" : ["tech@contoso.com"]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Organization
{
MarketingNotificationEmails = new List<string>
{
"marketing@contoso.com",
},
OnPremisesSyncEnabled = true,
PrivacyProfile = new PrivacyProfile
{
ContactEmail = "alice@contoso.com",
StatementUrl = "https://contoso.com/privacyStatement",
},
SecurityComplianceNotificationMails = new List<string>
{
"security@contoso.com",
},
SecurityComplianceNotificationPhones = new List<string>
{
"(123) 456-7890",
},
TechnicalNotificationMails = new List<string>
{
"tech@contoso.com",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Organization["{organization-id}"].PatchAsync(requestBody);
mgc-beta organization patch --organization-id {organization-id} --body '{\
"marketingNotificationEmails" : ["marketing@contoso.com"],\
"onPremisesSyncEnabled" : true,\
"privacyProfile" :\
{\
"contactEmail":"alice@contoso.com",\
"statementUrl":"https://contoso.com/privacyStatement"\
},\
"securityComplianceNotificationMails" : ["security@contoso.com"],\
"securityComplianceNotificationPhones" : ["(123) 456-7890"],\
"technicalNotificationMails" : ["tech@contoso.com"]\
}\
'
// 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.NewOrganization()
marketingNotificationEmails := []string {
"marketing@contoso.com",
}
requestBody.SetMarketingNotificationEmails(marketingNotificationEmails)
onPremisesSyncEnabled := true
requestBody.SetOnPremisesSyncEnabled(&onPremisesSyncEnabled)
privacyProfile := graphmodels.NewPrivacyProfile()
contactEmail := "alice@contoso.com"
privacyProfile.SetContactEmail(&contactEmail)
statementUrl := "https://contoso.com/privacyStatement"
privacyProfile.SetStatementUrl(&statementUrl)
requestBody.SetPrivacyProfile(privacyProfile)
securityComplianceNotificationMails := []string {
"security@contoso.com",
}
requestBody.SetSecurityComplianceNotificationMails(securityComplianceNotificationMails)
securityComplianceNotificationPhones := []string {
"(123) 456-7890",
}
requestBody.SetSecurityComplianceNotificationPhones(securityComplianceNotificationPhones)
technicalNotificationMails := []string {
"tech@contoso.com",
}
requestBody.SetTechnicalNotificationMails(technicalNotificationMails)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
organization, err := graphClient.Organization().ByOrganizationId("organization-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Organization organization = new Organization();
LinkedList<String> marketingNotificationEmails = new LinkedList<String>();
marketingNotificationEmails.add("marketing@contoso.com");
organization.setMarketingNotificationEmails(marketingNotificationEmails);
organization.setOnPremisesSyncEnabled(true);
PrivacyProfile privacyProfile = new PrivacyProfile();
privacyProfile.setContactEmail("alice@contoso.com");
privacyProfile.setStatementUrl("https://contoso.com/privacyStatement");
organization.setPrivacyProfile(privacyProfile);
LinkedList<String> securityComplianceNotificationMails = new LinkedList<String>();
securityComplianceNotificationMails.add("security@contoso.com");
organization.setSecurityComplianceNotificationMails(securityComplianceNotificationMails);
LinkedList<String> securityComplianceNotificationPhones = new LinkedList<String>();
securityComplianceNotificationPhones.add("(123) 456-7890");
organization.setSecurityComplianceNotificationPhones(securityComplianceNotificationPhones);
LinkedList<String> technicalNotificationMails = new LinkedList<String>();
technicalNotificationMails.add("tech@contoso.com");
organization.setTechnicalNotificationMails(technicalNotificationMails);
Organization result = graphClient.organization().byOrganizationId("{organization-id}").patch(organization);
const options = {
authProvider,
};
const client = Client.init(options);
const organization = {
marketingNotificationEmails: ['marketing@contoso.com'],
onPremisesSyncEnabled: true,
privacyProfile:
{
contactEmail: 'alice@contoso.com',
statementUrl: 'https://contoso.com/privacyStatement'
},
securityComplianceNotificationMails: ['security@contoso.com'],
securityComplianceNotificationPhones: ['(123) 456-7890'],
technicalNotificationMails: ['tech@contoso.com']
};
await client.api('/organization/84841066-274d-4ec0-a5c1-276be684bdd3')
.version('beta')
.update(organization);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Organization;
use Microsoft\Graph\Beta\Generated\Models\PrivacyProfile;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Organization();
$requestBody->setMarketingNotificationEmails(['marketing@contoso.com', ]);
$requestBody->setOnPremisesSyncEnabled(true);
$privacyProfile = new PrivacyProfile();
$privacyProfile->setContactEmail('alice@contoso.com');
$privacyProfile->setStatementUrl('https://contoso.com/privacyStatement');
$requestBody->setPrivacyProfile($privacyProfile);
$requestBody->setSecurityComplianceNotificationMails(['security@contoso.com', ]);
$requestBody->setSecurityComplianceNotificationPhones(['(123) 456-7890', ]);
$requestBody->setTechnicalNotificationMails(['tech@contoso.com', ]);
$result = $graphServiceClient->organization()->byOrganizationId('organization-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
marketingNotificationEmails = @(
"marketing@contoso.com"
)
onPremisesSyncEnabled = $true
privacyProfile = @{
contactEmail = "alice@contoso.com"
statementUrl = "https://contoso.com/privacyStatement"
}
securityComplianceNotificationMails = @(
"security@contoso.com"
)
securityComplianceNotificationPhones = @(
"(123) 456-7890"
)
technicalNotificationMails = @(
"tech@contoso.com"
)
}
Update-MgBetaOrganization -OrganizationId $organizationId -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.organization import Organization
from msgraph_beta.generated.models.privacy_profile import PrivacyProfile
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Organization(
marketing_notification_emails = [
"marketing@contoso.com",
],
on_premises_sync_enabled = True,
privacy_profile = PrivacyProfile(
contact_email = "alice@contoso.com",
statement_url = "https://contoso.com/privacyStatement",
),
security_compliance_notification_mails = [
"security@contoso.com",
],
security_compliance_notification_phones = [
"(123) 456-7890",
],
technical_notification_mails = [
"tech@contoso.com",
],
)
result = await graph_client.organization.by_organization_id('organization-id').patch(request_body)