名前空間: microsoft.graph
重要
Microsoft Graph の /beta バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
この API を使用して、ユーザーのプロファイルに新しい personName オブジェクトを作成 します。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
User.Read |
AgentIdUser.ReadWrite.All、AgentIdUser.ReadWrite.IdentityParentedBy、User.Read.All、User.ReadBasic.All、User.ReadWrite、User.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
User.Read |
User.ReadWrite |
| アプリケーション |
サポートされていません。 |
サポートされていません。 |
HTTP 要求
POST /me/profile/names
POST /users/{id | userPrincipalName}/profile/names
| 名前 |
説明 |
| Authorization |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
| Content-Type |
application/json. 必須です。 |
要求本文
要求本文で、 personName オブジェクトの JSON 表現を指定します。
次の表は、 personName オブジェクトを作成するときに設定できるプロパティを示しています。
| プロパティ |
型 |
説明 |
| allowedAudiences |
文字列 |
エンティティに含まれる値を表示できる対象ユーザー。
itemFacet から継承されます。 使用可能な値は、 me、 family、 contacts、 groupMembers、 organization、 federatedOrganizations、 everyone、 unknownFutureValueです。 |
| displayName |
文字列 |
ユーザーまたはデバイスのロケールに応じて、firstName と lastName の順序付きレンダリングを提供します。 |
| まずは |
文字列 |
ユーザーの名。 |
| id |
文字列 |
エンティティを個別にアドレス指定するために使用される識別子。
エンティティから継承 |
| 推論 |
inferenceData |
作成または変更するアプリケーションによってエンティティが推論される場合の推論の詳細が含まれます。
itemFacet から継承されます。 |
| initials |
String |
ユーザーのイニシャル。 |
| languageTag |
文字列 |
IETF BCP47 形式に続く言語 (en-US、no-NB、en-AU) の名前が含まれます。 |
| 前の |
文字列 |
ユーザーの姓。 |
| 乙女 |
文字列 |
ユーザーの旧姓。 |
| 中間 |
文字列 |
ユーザーのミドル ネーム。 |
| ニックネーム |
文字列 |
ユーザーのニックネーム。 |
| 発音 |
yomiPersonName |
ユーザー名の発音方法に関するガイダンス。 |
| サフィックス |
文字列 |
ユーザー名の後に使用される指定子 (例: PhD)。 |
| title |
String |
ユーザーの名前の前に付けるために使用される敬語 (たとえば、Dr、Sir、Madam、Mrs など)。 |
応答
成功した場合、このメソッドは応答コード 201, Created 返し、応答本文に新しい personName オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/me/profile/names
Content-type: application/json
{
"displayName": "Innocenty Popov",
"first": "Innocenty",
"initials": "IP",
"last": "Popov",
"languageTag": "en-US",
"maiden": null
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PersonName
{
DisplayName = "Innocenty Popov",
First = "Innocenty",
Initials = "IP",
Last = "Popov",
LanguageTag = "en-US",
Maiden = null,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Profile.Names.PostAsync(requestBody);
// 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.NewPersonName()
displayName := "Innocenty Popov"
requestBody.SetDisplayName(&displayName)
first := "Innocenty"
requestBody.SetFirst(&first)
initials := "IP"
requestBody.SetInitials(&initials)
last := "Popov"
requestBody.SetLast(&last)
languageTag := "en-US"
requestBody.SetLanguageTag(&languageTag)
maiden := null
requestBody.SetMaiden(&maiden)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
names, err := graphClient.Me().Profile().Names().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PersonName personName = new PersonName();
personName.setDisplayName("Innocenty Popov");
personName.setFirst("Innocenty");
personName.setInitials("IP");
personName.setLast("Popov");
personName.setLanguageTag("en-US");
personName.setMaiden(null);
PersonName result = graphClient.me().profile().names().post(personName);
const options = {
authProvider,
};
const client = Client.init(options);
const personName = {
displayName: 'Innocenty Popov',
first: 'Innocenty',
initials: 'IP',
last: 'Popov',
languageTag: 'en-US',
maiden: null
};
await client.api('/me/profile/names')
.version('beta')
.post(personName);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\PersonName;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PersonName();
$requestBody->setDisplayName('Innocenty Popov');
$requestBody->setFirst('Innocenty');
$requestBody->setInitials('IP');
$requestBody->setLast('Popov');
$requestBody->setLanguageTag('en-US');
$requestBody->setMaiden(null);
$result = $graphServiceClient->me()->profile()->names()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.People
$params = @{
displayName = "Innocenty Popov"
first = "Innocenty"
initials = "IP"
last = "Popov"
languageTag = "en-US"
maiden = $null
}
# A UPN can also be used as -UserId.
New-MgBetaUserProfileName -UserId $userId -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.person_name import PersonName
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PersonName(
display_name = "Innocenty Popov",
first = "Innocenty",
initials = "IP",
last = "Popov",
language_tag = "en-US",
maiden = None,
)
result = await graph_client.me.profile.names.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"id": "0fb4c1e3-c1e3-0fb4-e3c1-b40fe3c1b40f",
"allowedAudiences": "organization",
"inference": null,
"createdDateTime": "2020-07-06T06:34:12.2294868Z",
"createdBy": {
"application": null,
"device": null,
"user": {
"displayName": "Innocenty Popov",
"id": "db789417-4ccb-41d1-a0a9-47b01a09ea49"
}
},
"lastModifiedDateTime": "2020-07-06T06:34:12.2294868Z",
"lastModifiedBy": {
"application": null,
"device": null,
"user": {
"displayName": "Innocenty Popov",
"id": "db789417-4ccb-41d1-a0a9-47b01a09ea49"
}
},
"displayName": "Innocenty Popov",
"first": "Innocenty",
"initials": "IP",
"last": "Popov",
"languageTag": "en-US",
"maiden": null,
"middle": null,
"nickname": null,
"suffix": null,
"title": null,
"pronunciation": null
}