Update organization
Article
08/17/2022
3 minutes to read
11 contributors
Feedback
In this article
Namespace: microsoft.graph
Update the properties of the currently authenticated organization. In this case, organization is defined as a collection of exactly one record, and so its ID must be specified in the request. The ID is also known as the tenantId of the organization.
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)
Organization.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
Organization.ReadWrite.All
HTTP request
PATCH /organization/{id}
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json
Request body
In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance, you shouldn't include existing values that haven't changed.
Property
Type
Description
marketingNotificationEmails
String collection
Notes : not nullable.
privacyProfile
privacyProfile
The privacy profile of an organization (set statementUrl and contactEmail).
securityComplianceNotificationMails
String collection
securityComplianceNotificationPhones
String collection
technicalNotificationMails
String collection
Notes : not nullable.
Response
If successful, this method returns a 204 No Content response code.
Example
Request
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"]
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var organization = 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"
}
};
await graphClient.Organization["{organization-id}"]
.Request()
.UpdateAsync(organization);
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 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);
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();
Organization organization = new Organization();
LinkedList<String> marketingNotificationEmailsList = new LinkedList<String>();
marketingNotificationEmailsList.add("marketing@contoso.com");
organization.marketingNotificationEmails = marketingNotificationEmailsList;
PrivacyProfile privacyProfile = new PrivacyProfile();
privacyProfile.contactEmail = "alice@contoso.com";
privacyProfile.statementUrl = "https://contoso.com/privacyStatement";
organization.privacyProfile = privacyProfile;
LinkedList<String> securityComplianceNotificationMailsList = new LinkedList<String>();
securityComplianceNotificationMailsList.add("security@contoso.com");
organization.securityComplianceNotificationMails = securityComplianceNotificationMailsList;
LinkedList<String> securityComplianceNotificationPhonesList = new LinkedList<String>();
securityComplianceNotificationPhonesList.add("(123) 456-7890");
organization.securityComplianceNotificationPhones = securityComplianceNotificationPhonesList;
LinkedList<String> technicalNotificationMailsList = new LinkedList<String>();
technicalNotificationMailsList.add("tech@contoso.com");
organization.technicalNotificationMails = technicalNotificationMailsList;
graphClient.organization("84841066-274d-4ec0-a5c1-276be684bdd3")
.buildRequest()
.patch(organization);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
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)
result, err := graphClient.OrganizationById("organization-id").Patch(context.Background(), requestBody, nil)
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.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
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 FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$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', ]);
$requestResult = $graphServiceClient->organizationById('organization-id')->patch($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
HTTP/1.1 204 No Content