重要
授予 User.Read 权限的应用程序只能读取组织的 id、 displayName 和 verifiedDomains 属性。 所有其他属性返回值 null
。 若要读取所有属性,请至少使用 Organization.Read.All。
在具有工作或学校帐户的委托方案中,必须为登录用户分配受支持的Microsoft Entra角色或具有支持的角色权限的自定义角色。 此操作支持以下最低特权角色。
- AdHoc 许可证管理员
- 应用程序管理员
- 身份验证管理员
- Azure 信息保护管理员
- Azure 信息保护管理员
- 帐务管理员
- 云应用程序管理员
- 合规数据管理员
- 客户密码箱访问审批者
- 客户密码箱访问审批者
- 桌面分析管理员
- 目录读取器
- 目录审阅者
- 目录同步帐户 - 用于 Microsoft Entra Connect 和 Microsoft Entra Cloud Sync 服务
- 目录作者
- Dynamics 365管理员
- Dynamics 365管理员
- 全局读取者
- 来宾用户
- 帮助台管理员
- 混合标识管理员
- Insights 管理员
- Kaizala 管理员
- 许可证管理员
- 邮箱管理员
- Microsoft托管桌面管理员
- 适用于企业的 Microsoft Store用户
- 新式商务管理员
- Power BI 管理员
- Power BI 管理员
- 特权身份验证管理员
- 特权角色管理员
- 受限来宾用户
- 安全管理员
- 安全操作员
- 安全信息读取者
- 服务支持管理员
- Teams 管理员
- Teams 通信管理员
- Teams 通信支持工程师
- Teams 通信支持专家
- 用户
- 用户管理员
- 批量许可业务中心用户
- 批量许可服务中心用户
在请求正文中,提供应更新的相关字段的值。 请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。 为了实现最佳性能,不得添加尚未变化的现有值。
PATCH https://graph.microsoft.com/v1.0/organization/84841066-274d-4ec0-a5c1-276be684bdd3
Content-type: application/json
{
"marketingNotificationEmails" : ["marketing@contoso.com"],
"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.Models;
var requestBody = new Organization
{
MarketingNotificationEmails = new List<string>
{
"marketing@contoso.com",
},
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);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc organization patch --organization-id {organization-id} --body '{\
"marketingNotificationEmails" : ["marketing@contoso.com"],\
"privacyProfile" :\
{\
"contactEmail":"alice@contoso.com",\
"statementUrl":"https://contoso.com/privacyStatement"\
},\
"securityComplianceNotificationMails" : ["security@contoso.com"],\
"securityComplianceNotificationPhones" : ["(123) 456-7890"],\
"technicalNotificationMails" : ["tech@contoso.com"]\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewOrganization()
marketingNotificationEmails := []string {
"marketing@contoso.com",
}
requestBody.SetMarketingNotificationEmails(marketingNotificationEmails)
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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// 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);
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);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const organization = {
marketingNotificationEmails: ['marketing@contoso.com'],
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')
.update(organization);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Organization;
use Microsoft\Graph\Generated\Models\PrivacyProfile;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Organization();
$requestBody->setMarketingNotificationEmails(['marketing@contoso.com', ]);
$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();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.Identity.DirectoryManagement
$params = @{
marketingNotificationEmails = @(
"marketing@contoso.com"
)
privacyProfile = @{
contactEmail = "alice@contoso.com"
statementUrl = "https://contoso.com/privacyStatement"
}
securityComplianceNotificationMails = @(
"security@contoso.com"
)
securityComplianceNotificationPhones = @(
"(123) 456-7890"
)
technicalNotificationMails = @(
"tech@contoso.com"
)
}
Update-MgOrganization -OrganizationId $organizationId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.organization import Organization
from msgraph.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",
],
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)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。