名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
organizationの新しい profileCardProperty を作成します。 新しいプロパティは、 directoryPropertyName プロパティによって識別されます。
organizationのプロファイル カードにプロパティを追加する方法の詳細については、「プロファイル カード API を使用してプロファイル カードにカスタム属性を追加または削除する」を参照してください。
注:
プロファイル カード プロパティは、Microsoft Entra IDの属性に対応します。 organizationの profileCardProperties コレクションに profileCardProperty として属性を追加すると、属性値を表示するようにプロファイル カードが構成されます。 コレクションから profileCardProperty を削除しても、Microsoft Entra IDから属性は削除されません。プロファイル カードが属性値を表示しなくなったように構成を削除します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
委任 (職場または学校のアカウント) |
PeopleSettings.ReadWrite.All |
注意事項なし。 |
委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
サポートされていません。 |
アプリケーション |
サポートされていません。 |
サポートされていません。 |
手記:この操作に委任されたアクセス許可を使用するには、サインインしているユーザーにテナント管理者またはPeople管理者ロールが必要です。
HTTP 要求
POST /admin/people/profileCardProperties
注:/organization/{organizationId}/settings
パスは廃止されます。 今後は、/admin/people
パスを使用してください。
名前 |
説明 |
Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
Content-Type |
application/json. Required. |
手記: ペイロードの形式が正しくないエンコードの問題を回避するには、 Content-Type: application/json; charset=utf-8
を使用します。
要求本文
要求本文で、 profileCardProperty オブジェクトの JSON 表現を指定します。
organizationの profileCardProperty を作成するときに、次のプロパティを指定できます。
プロパティ |
型 |
説明 |
注釈 |
profileCardAnnotation コレクション |
管理者が指定することを選択した代替ラベルまたはローカライズされたラベル。 |
directoryPropertyName |
String |
プロファイル カードに表示するディレクトリ プロパティの名前。 |
応答
成功した場合、このメソッドは 201 Created
応答コードと、応答本文に新しい profileCardProperty オブジェクトを返します。
例
要求
次の例は要求を示しています。
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)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json; charset=utf-8
{
"directoryPropertyName": "CustomAttribute1",
"annotations": [
{
"displayName": "Cost Center",
"localizations": [
{
"languageTag": "ru",
"displayName": "центр затрат"
}
]
}
]
}