Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta
Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Erstellen Sie eine neue profileCardProperty für eine organization. Die neue Eigenschaft wird durch ihre directoryPropertyName-Eigenschaft identifiziert.
Weitere Informationen zum Hinzufügen von Eigenschaften zum Profil Karte für eine organization finden Sie unter Hinzufügen oder Entfernen von benutzerdefinierten Attributen für ein Profil Karte mithilfe der Profil-Karte-API.
Hinweis
Profileigenschaften Karte entsprechen Attributen in Microsoft Entra ID. Durch das Hinzufügen eines Attributs als profileCardProperty zur profileCardProperties-Auflistung für eine organization werden Profilkarten so konfiguriert, dass der Attributwert angezeigt wird. Durch das Löschen von profileCardProperty aus der Auflistung wird das Attribut nicht aus Microsoft Entra ID gelöscht. Die Konfiguration wird gelöscht, sodass der Attributwert auf Profilkarten nicht mehr angezeigt wird.
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) |
PeopleSettings.ReadWrite.All |
Nicht verfügbar. |
Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
Anwendung |
Nicht unterstützt |
Nicht unterstützt |
Anmerkung: Für die Verwendung delegierter Berechtigungen für diesen Vorgang muss der angemeldete Benutzer über die Rolle Mandantenadministrator oder Personen Administrator verfügen.
HTTP-Anforderung
POST /admin/people/profileCardProperties
Hinweis: Der /organization/{organizationId}/settings
-Pfad ist veraltet. Verwenden Sie in Zukunft den /admin/people
-Pfad.
Anmerkung: Um Codierungsprobleme zu vermeiden, die die Nutzlast falsch behandeln, verwenden Sie Content-Type: application/json; charset=utf-8
.
Anforderungstext
Geben Sie im Anforderungstext eine JSON-Darstellung eines profileCardProperty-Objekts an.
Sie können die folgenden Eigenschaften angeben, wenn Sie eine profileCardProperty für eine organization erstellen.
Eigenschaft |
Typ |
Beschreibung |
Anmerkungen |
profileCardAnnotation-Auflistung |
Alle alternativen oder lokalisierten Bezeichnungen, die ein Administrator angegeben hat. |
directoryPropertyName |
Zeichenfolge |
Der Name der Verzeichniseigenschaft, die im Profil Karte angezeigt werden soll. |
Antwort
Bei erfolgreicher Ausführung gibt die Methode einen 201 Created
Antwortcode und ein neues profileCardProperty-Objekt im Antworttext zurück.
Beispiele
Anforderung
Das folgende Beispiel zeigt eine Anfrage.
POST https://graph.microsoft.com/beta/admin/people/profileCardProperties
Content-type: application/json; charset=utf-8
{
"directoryPropertyName": "CustomAttribute1",
"annotations": [
{
"displayName": "Cost Center",
"localizations": [
{
"languageTag": "ru",
"displayName": "центр затрат"
}
]
}
]
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ProfileCardProperty
{
DirectoryPropertyName = "CustomAttribute1",
Annotations = new List<ProfileCardAnnotation>
{
new ProfileCardAnnotation
{
DisplayName = "Cost Center",
Localizations = new List<DisplayNameLocalization>
{
new DisplayNameLocalization
{
LanguageTag = "ru",
DisplayName = "центр затрат",
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Admin.People.ProfileCardProperties.PostAsync(requestBody);
mgc-beta admin people profile-card-properties create --body '{\
"directoryPropertyName": "CustomAttribute1",\
"annotations": [\
{\
"displayName": "Cost Center",\
"localizations": [\
{\
"languageTag": "ru",\
"displayName": "центр затрат"\
}\
]\
}\
]\
}\
'
// 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.NewProfileCardProperty()
directoryPropertyName := "CustomAttribute1"
requestBody.SetDirectoryPropertyName(&directoryPropertyName)
profileCardAnnotation := graphmodels.NewProfileCardAnnotation()
displayName := "Cost Center"
profileCardAnnotation.SetDisplayName(&displayName)
displayNameLocalization := graphmodels.NewDisplayNameLocalization()
languageTag := "ru"
displayNameLocalization.SetLanguageTag(&languageTag)
displayName := "центр затрат"
displayNameLocalization.SetDisplayName(&displayName)
localizations := []graphmodels.DisplayNameLocalizationable {
displayNameLocalization,
}
profileCardAnnotation.SetLocalizations(localizations)
annotations := []graphmodels.ProfileCardAnnotationable {
profileCardAnnotation,
}
requestBody.SetAnnotations(annotations)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
profileCardProperties, err := graphClient.Admin().People().ProfileCardProperties().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ProfileCardProperty profileCardProperty = new ProfileCardProperty();
profileCardProperty.setDirectoryPropertyName("CustomAttribute1");
LinkedList<ProfileCardAnnotation> annotations = new LinkedList<ProfileCardAnnotation>();
ProfileCardAnnotation profileCardAnnotation = new ProfileCardAnnotation();
profileCardAnnotation.setDisplayName("Cost Center");
LinkedList<DisplayNameLocalization> localizations = new LinkedList<DisplayNameLocalization>();
DisplayNameLocalization displayNameLocalization = new DisplayNameLocalization();
displayNameLocalization.setLanguageTag("ru");
displayNameLocalization.setDisplayName("центр затрат");
localizations.add(displayNameLocalization);
profileCardAnnotation.setLocalizations(localizations);
annotations.add(profileCardAnnotation);
profileCardProperty.setAnnotations(annotations);
ProfileCardProperty result = graphClient.admin().people().profileCardProperties().post(profileCardProperty);
const options = {
authProvider,
};
const client = Client.init(options);
const profileCardProperty = {
directoryPropertyName: 'CustomAttribute1',
annotations: [
{
displayName: 'Cost Center',
localizations: [
{
languageTag: 'ru',
displayName: 'центр затрат'
}
]
}
]
};
await client.api('/admin/people/profileCardProperties')
.version('beta')
.post(profileCardProperty);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ProfileCardProperty;
use Microsoft\Graph\Beta\Generated\Models\ProfileCardAnnotation;
use Microsoft\Graph\Beta\Generated\Models\DisplayNameLocalization;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ProfileCardProperty();
$requestBody->setDirectoryPropertyName('CustomAttribute1');
$annotationsProfileCardAnnotation1 = new ProfileCardAnnotation();
$annotationsProfileCardAnnotation1->setDisplayName('Cost Center');
$localizationsDisplayNameLocalization1 = new DisplayNameLocalization();
$localizationsDisplayNameLocalization1->setLanguageTag('ru');
$localizationsDisplayNameLocalization1->setDisplayName('центр затрат');
$localizationsArray []= $localizationsDisplayNameLocalization1;
$annotationsProfileCardAnnotation1->setLocalizations($localizationsArray);
$annotationsArray []= $annotationsProfileCardAnnotation1;
$requestBody->setAnnotations($annotationsArray);
$result = $graphServiceClient->admin()->people()->profileCardProperties()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Identity.DirectoryManagement
$params = @{
directoryPropertyName = "CustomAttribute1"
annotations = @(
@{
displayName = "Cost Center"
localizations = @(
@{
languageTag = "ru"
displayName = "центр затрат"
}
)
}
)
}
New-MgBetaAdminPeopleProfileCardProperty -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.profile_card_property import ProfileCardProperty
from msgraph_beta.generated.models.profile_card_annotation import ProfileCardAnnotation
from msgraph_beta.generated.models.display_name_localization import DisplayNameLocalization
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ProfileCardProperty(
directory_property_name = "CustomAttribute1",
annotations = [
ProfileCardAnnotation(
display_name = "Cost Center",
localizations = [
DisplayNameLocalization(
language_tag = "ru",
display_name = "центр затрат",
),
],
),
],
)
result = await graph_client.admin.people.profile_card_properties.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 201 Created
Content-type: application/json; charset=utf-8
{
"directoryPropertyName": "CustomAttribute1",
"annotations": [
{
"displayName": "Cost Center",
"localizations": [
{
"languageTag": "ru",
"displayName": "центр затрат"
}
]
}
]
}