Les propriétés de carte de profil correspondent aux attributs dans Microsoft Entra ID. L’ajout d’un attribut en tant que profileCardProperty à la collection profileCardProperties pour un organization configure les cartes de profil pour afficher la valeur de l’attribut. La suppression de profileCardProperty de la collection ne supprime pas l’attribut de Microsoft Entra ID ; elle supprime la configuration afin que les cartes de profil n’affichent plus la valeur de l’attribut.
Note: L’utilisation d’autorisations déléguées pour cette opération nécessite que l’utilisateur connecté ait un rôle Administrateur de locataire ou Administrateur général.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.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);
// 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);
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultez https://aka.ms/ContentUserFeedback.