Namespace: microsoft.graph
Mit dieser API können Sie die Eigenschaften der aktuell authentifizierten Organisation aktualisieren. In diesem Fall organization ist als Sammlung von genau einem Datensatz definiert, sodass seine ID in der Anforderung angegeben werden muss. Die ID wird auch als tenantId des organization bezeichnet.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
✅ |
✅ |
✅ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Organization.ReadWrite.All |
Nicht verfügbar. |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Organization.ReadWrite.All |
Nicht verfügbar. |
Wichtig
Anwendungen, denen die User.Read-Berechtigung gewährt wurde, können nur die Eigenschaften id, displayName und verifiedDomains des organization lesen. Alle anderen Eigenschaften geben mit null Werten zurück. Um alle Eigenschaften zu lesen, verwenden Sie mindestens Organization.Read.All.
In delegierten Szenarien mit Geschäfts-, Schul- oder Unikonten muss dem angemeldeten Benutzer eine unterstützte Microsoft Entra Rolle oder eine benutzerdefinierte Rolle mit einer unterstützten Rollenberechtigung zugewiesen werden. Die folgenden Rollen mit den geringsten Berechtigungen werden für diesen Vorgang unterstützt.
- AdHoc-Lizenzadministrator
- Anwendungsadministrator
- Authentifizierungsadministrator
- Azure Information Protection Administrator
- Azure Information Protection Administrator
- Abrechnungsadministrator
- Cloudanwendungsadministrator
- Compliancedatenadministrator
- Genehmigen der LockBox-Zugriffsberechtigung für Kunden
- Genehmigen der LockBox-Zugriffsberechtigung für Kunden
- Desktop Analytics Administrator
- Verzeichnisleser
- Verzeichnisprüfer
- Verzeichnissynchronisierungskonten für Microsoft Entra Connect und Microsoft Entra Cloud Sync-Dienste
- Verzeichnisautoren
- Dynamics 365 Administrator
- Dynamics 365 Administrator
- Globaler Leser
- Gastbenutzer
- Helpdesk-Administrator
- Hybrididentitätsadministrator
- Insights-Administrator
- Kaizala-Administrator
- Lizenzadministrator
- Postfachadministrator
- Microsoft Managed Desktop Administrator
- Microsoft Store für Unternehmen-Benutzer
- Modern Commerce-Administrator
- Power BI-Administrator
- Power BI-Administrator
- Privilegierter Authentifizierungsadministrator
- Administrator für privilegierte Rollen
- Eingeschränkter Gastbenutzer
- Sicherheitsadministrator
- Sicherheitsoperator
- Sicherheitsleseberechtigter
- Dienst-Supportadministrator
- Teams-Administrator
- Teams-Kommunikationsadministrator
- Supporttechniker für die Teams-Kommunikation
- Supportfachmann für die Teams-Kommunikation
- Benutzer
- Benutzeradministrator
- Business Center-Benutzer für Volumenlizenzierung
- Volume Licensing Service Center-Benutzer
HTTP-Anforderung
PATCH /organization/{id}
Anforderungstext
Geben Sie im Anforderungstext die Werte für die relevanten Felder an, die aktualisiert werden sollen. Vorhandene Eigenschaften, die nicht im Anforderungstext enthalten sind, behalten ihre vorherigen Werte oder werden basierend auf Änderungen an anderen Eigenschaftswerten neu berechnet. Aus Gründen der Leistung sollten Sie vorhandene Werte, die nicht geändert wurden, nicht angeben.
| Eigenschaft |
Typ |
Beschreibung |
| marketingNotificationEmails |
Zeichenfolgenauflistung |
Hinweis: Lässt keine Nullwerte zu. |
| privacyProfile |
privacyProfile |
Das Datenschutzprofil einer Organisation ( „statementUrl“ und „contactEmail“ festlegen). |
| securityComplianceNotificationMails |
String collection |
|
| securityComplianceNotificationPhones |
Zeichenfolgenauflistung |
|
| technicalNotificationMails |
Zeichenfolgenauflistung |
Hinweis: Lässt keine Nullwerte zu. |
Antwort
Wenn die Methode erfolgreich verläuft, wird der Antwortcode 204 No Content zurückgegeben.
Beispiel
Anforderung
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
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);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?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();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
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
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# 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)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
HTTP/1.1 204 No Content