ユーザー プロファイル REST API リファレンス

REST API の PeopleManager、ProfileLoader、UserProfile、その他のユーザー プロファイル関連のリソースおよびエンドポイントについて説明します。

適用対象: apps for SharePoint | SharePoint Online | SharePoint Server 2013

この記事の内容
この記事で示されている要求の各例について
PeopleManager のリソース
ProfileLoader のリソース
UserProfile のリソース
ユーザープロファイルに関連する REST 応答で返される SP.UserProfiles リソース
実装メモ
その他の技術情報

この記事で示されている要求の各例について

この記事に出てくる例では jQuery AJAX 要求が使用されています。これらの例を使用する前に、次の操作を実行してください。

  • <サイト url>、および ID、名前、SharePoint エンティティのパスなどその他プレースホルダーのデータを変更します。

  • OAuth を使用する場合は、Authorization ヘッダー ("Authorization": "Bearer " + <access token>) を追加して OAuth アクセス トークンを送信します。

  • 要求の例の url および data プロパティ値から改行を削除します。改行は、例を分かりやすくするために追加されています。

  • サーバーが Atom 形式で応答を返すようにするには、"accept": "application/json;odata=verbose" ヘッダーを削除します。

要求を変更する方法についての詳細は、「環境によって異なる REST 要求の方法」を参照してください。クロスドメイン ライブラリ、OAuth、および SharePoint サービスの使用法についての詳細は、「その他の技術情報」を参照してください。

ヒント

SharePoint Online REST サービスは、OData $batch クエリ オプションを使用して複数の要求を、サービスに対する 1 つの呼び出しに結合できます。詳細とコード サンプルへのリンクについては、「REST API によりバッチ要求を発行する」をご覧ください。このオプションは、オンプレミスの SharePoint ではサポートされていません。

PeopleManager のリソース

エンドポイント URI  |  プロパティ  |  メソッド  |  OData 表現

ユーザーに関連する操作のメソッドを提供します。

SocialRestFollowingManager API は、ユーザー フォロー タスクとコンテンツ フォロー タスクで推奨されますが、PeopleManager は、SocialRestFollowingManager が提供しない機能をいくつか提供します。

エンドポイント URI

http://<サイトの url>/_api/sp.userprofiles.peoplemanager

サポートされる HTTP メソッド

GET  |  POST

要求の例

GET 要求の例: 現在の PeopleManager インスタンスを取得

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

PeopleManager プロパティ

プロパティを取得するには、以下の例に示されているように、GET 要求をプロパティ エンドポイントに送信します。

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager/<property name>",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

プロパティ

R/W

リソースとともに返される

説明

EditProfileLink

String

R

はい

現在のユーザーのプロファイル編集ページの URL。

IsMyPeopleListPublic

Boolean

R

はい

現在のユーザーの [フォローしている人々] のリストが公開されているかどうかを示す Boolean の値。

PeopleManager メソッド

AmIFollowedBy
AmIFollowing
Follow
FollowTag
GetFollowedTags
GetFollowersFor
GetMyFollowers
GetMyProperties
GetMySuggestions
GetPeopleFollowedBy
GetPeopleFollowedByMe
GetPropertiesFor
GetTrendingTags
GetUserProfilePropertyFor
HideSuggestion
IsFollowing
SetMyProfilePicture
StopFollowing
StopFollowingTag

AmIFollowedBy メソッド

指定されたユーザーが現在のユーザーをフォローしているかどうかを確認します。

エンドポイント

/amifollowedby(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: Boolean
指定されたユーザーが現在のユーザーをフォローしている場合は true、そうでない場合は false。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /amifollowedby(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

AmIFollowing メソッド

現在のユーザーが指定されたユーザーをフォローしているかどうかを確認します。

エンドポイント

/amifollowing(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: Boolean
現在のユーザーが指定されたユーザーをフォローしている場合は true、そうでない場合は false。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /amifollowing(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

Follow メソッド

現在のユーザーがフォローしているユーザーのリストに、指定されたユーザーを追加します。

このタスクの使用に推奨される API は social.following/follow です。

エンドポイント

/follow(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /follow(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

FollowTag メソッド

現在のユーザーがフォローしているタグのリストに、指定されたタグを追加します。

このタスクの使用に推奨される API は social.following/follow です。

エンドポイント

/followtag('<tag id>')

パラメーター

型: GUID
フォローを開始するタグの ID。REST を使用して タグ ID のクエリを実行することはできませんが、 JavaScript オブジェクト モデルを使用してタグ ID を取得することや, .NET クライアント オブジェクト モデルを使用して取得することはできます。また、タグがトレンド タグの場合は、GetTrendingTags メソッドを呼び出して、HashTag 名 からタグ ID を取得できます。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /followtag('3e324ad0-de47-4c0a-b9c6-59fda8419430')",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

GetFollowedTags メソッド

ユーザーがフォローしているタグを取得します。

エンドポイント

/getfollowedtags(<max count>)

パラメーター

型: Int32
取得するタグの最大数。

HTTP method

GET

応答

型: Collection(String)
ユーザーがフォローしているタグ (指定された数以内)。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getfollowedtags(5)",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetFollowersFor メソッド

指定されたユーザーをフォローしているユーザーを取得します。

エンドポイント

/getfollowersfor(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: Collection(SP.UserProfiles.PersonProperties)
指定されたユーザーをフォローしているユーザー。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getfollowersfor(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetMyFollowers メソッド

現在のユーザーをフォローしているユーザーを取得します。

このタスクの使用に推奨される API はsocial.following/getfollowers です。

エンドポイント

/getmyfollowers

パラメーター

なし

HTTP method

GET

応答

型: Collection(SP.UserProfiles.PersonProperties)
現在のユーザーをフォローしているユーザー。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getmyfollowers",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetMyProperties メソッド

現在のユーザーのユーザー プロパティを取得します。

エンドポイント

/getmyproperties

パラメーター

なし

HTTP method

GET

応答

型: SP.UserProfiles.PersonProperties
現在のユーザーのユーザー プロパティ。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getmyproperties",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetMySuggestions メソッド

現在のユーザーがフォローする可能性のあるユーザーの提案を取得します。

このタスクの使用に推奨される API は social.following/getsuggestions です。

エンドポイント

/getmysuggestions

パラメーター

なし

HTTP method

GET

応答

型: Collection(SP.UserProfiles.PersonProperties)
現在のユーザーがフォローする可能性のあるユーザー。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getmysuggestions",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetPeopleFollowedBy メソッド

指定されたユーザーがフォローしている人々を取得します。

エンドポイント

/getpeoplefollowedby(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: Collection(SP.UserProfiles.PersonProperties)
指定されたユーザーがフォローしているユーザー。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getpeoplefollowedby(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetPeopleFollowedByMe メソッド

現在のユーザーがフォローしている人々を取得します。

このタスクの使用に推奨される API は social.following/getfollowed です。

エンドポイント

/getpeoplefollowedbyme

パラメーター

なし

HTTP method

GET

Response

型: Collection(SP.UserProfiles.PersonProperties)
現在のユーザーがフォローしているユーザー。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getpeoplefollowedbyme",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetPropertiesFor メソッド

指定されたユーザーのユーザー プロパティを取得します。

エンドポイント

/getpropertiesfor(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: SP.UserProfiles.PersonProperties
指定されたユーザーのユーザー プロパティ。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getpropertiesfor(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetTrendingTags メソッド

最も人気のあるタグを取得します。 静的メソッドです。

エンドポイント

/sp.userprofiles.peoplemanager.gettrendingtags

パラメーター

なし

HTTP method

GET

応答

型: SP.UserProfiles.HashTagCollection
過去 1 週間で人気のあったハッシュタグの上位 20 個を取得し、最も人気のあるタグが最初に表示されるように並べ替えます。

要求の例

$.ajax({
  url: "http://<site url>/_api/
    /sp.userprofiles.peoplemanager.gettrendingtags,
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

GetUserProfilePropertyFor メソッド

指定されたユーザーの指定されたユーザー プロファイル プロパティを取得します。

GetUserProfilePropertiesFor メソッドは、REST API に実装されていません。すべてのユーザー プロファイル プロパティを取得するには、GetPropertiesFor メソッドを呼び出して、返される PersonProperties オブジェクトの UserProfileProperties プロパティからユーザー プロファイル プロパティを取得します。

エンドポイント

/getuserprofilepropertyfor(accountname=@v, propertyname='<property name>')?@v='<account name>'

パラメーター

accountname

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

propertyName

型: String
取得するプロパティの名前 (大文字と小文字を区別)。

HTTP method

GET

応答

型: String
指定されたユーザーの指定されたプロファイル プロパティ。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /getuserprofilepropertyfor(accountame=@v, propertyname='PictureURL')
        ?@v='i%3A0%23.f%7Cmembership%7Cuser%domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

HideSuggestion メソッド

フォローを提案されたユーザーのリストから、指定されたユーザーを削除します。

エンドポイント

/hidesuggestion(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /hidesuggestion(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%domain.onmicrosoft.com'",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

IsFollowing メソッド

最初のユーザーが 2 番目のユーザーをフォローしているかどうかを確認します。静的メソッドです。

エンドポイント

/sp.userprofiles.peoplemanager.isfollowing(
  possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)
  ?@v='<account name>'&@y='<account name>'

パラメーター

possiblefolloweraccountname

型: String
フォローしている可能性があるユーザー possiblefolloweeaccountname のアカウント名。要求の例で示すように、クエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

possiblefolloweeaccountname

型: String
フォローされている可能性があるユーザーのアカウント名。要求の例で示すように、クエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

GET

応答

型: Boolean
最初のユーザーが 2 番目のユーザーをフォローしている場合は true、そうでない場合は false。

要求の例

$.ajax({
  url: "http://<site url>/_api
    /sp.userprofiles.peoplemanager.isfollowing(possiblefolloweraccountname=@v,possiblefolloweeaccountname=@y)
      ?@v='i%3A0%23.f%7Cmembership%7Cuser1%40domain.onmicrosoft.com'
      &@y='i%3A0%23.f%7Cmembership%7Cuser2%40domain.onmicrosoft.com'",
  type: "GET",
  headers: { "accept": "application/json;odata=verbose" },
  success: successHandler,
  error: errorHandler
});

SetMyProfilePicture メソッド

ユーザー プロファイル画像をアップロードして設定します。ユーザーは、自分のプロファイルのみに画像をアップロードできます。

エンドポイント

/setmyprofilepicture

パラメーター

型: Stream
BMP、JPEG、または PNG 形式の最大 4.76 MB の画像。このパラメーターは要求本文で送信します。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /setmyprofilepicture",
  type: "POST",
  data: arrayBuffer,
  processData: false,
  headers: {
    "accept": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
    "content-length": arrayBuffer.byteLength
 },
  success: successHandler,
  error: errorHandler
});

次の JavaScript および jQuery のコード例は、SharePoint ホスト型アプリの App.js の内容を表します。ユーザーが Default.aspx ページのファイル入力コントロールでローカル ファイルを選択したものと想定しています。

'use strict';

$(document).ready(function () {

    // Check to see if the browser supports the HTML5 FileReader API.
    if (!window.FileReader) {
        alert('This browser does not support the FileReader API.');
    }
});

function setProfilePicture() {

    // First get the file buffer and then send the request.
    var call = getFileBuffer();
    call.done(function (arrayBuffer) {
        setMyProfilePicture(arrayBuffer);
    });
    call.fail(function (error) {
        alert(error);
    });

    // Get the ArrayBuffer for the picture file.
    function getFileBuffer() {

        // Get the file from the file input control on the page.
        // Pictures can be BMP, JPG, or PNG format and up to 5 million bytes.
        var file = $('#profilePic')[0].files[0];

        var deferred = $.Deferred();
        var reader = new FileReader();
        reader.onloadend = function (e) {
            deferred.resolve(e.target.result);
        }
        reader.onerror = function (e) {
            deferred.reject(e.target.error);
        }
        reader.readAsArrayBuffer(file);
        return deferred.promise();
    }

    // Send the POST request.
    function setMyProfilePicture(arrayBuffer) { 

        // Get the site URL and construct the endpoint URI for the rest post.
        var absoluteUrl = _spPageContextInfo.webAbsoluteUrl;
        var setPictureEndpoint = absoluteUrl +
            "/_api/sp.userprofiles.peoplemanager/setmyprofilepicture";

        $.ajax({
            url: setPictureEndpoint,
            type: "POST",
            data: arrayBuffer,
            processData: false,
            headers: {
                "accept": "application/json;odata=verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                "content-length": arrayBuffer.byteLength
            },
            success: function (data) {
                alert('SetMyProfilePicture succeeded.');
            },
            error: function (error) {
                alert(error.responseText);
            }
        });
    }
}

StopFollowing メソッド

現在のユーザーがフォローしているユーザーのリストから、指定されたユーザーを削除します。

このタスクの使用に推奨される API は social.following/stopfollowing です。

エンドポイント

/stopfollowing(@v)?@v='<account name>'

パラメーター

型: String
ユーザーのアカウント名。要求の例で示すようにクエリ文字列でエイリアスとしてエンコードされて渡されます。その他の形式の例については、「実装メモ」を参照してください。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /stopfollowing(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%domain.onmicrosoft.com'",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

StopFollowingTag メソッド

現在のユーザーがフォローしているタグのリストから、指定されたタグを削除します。

このタスクの使用に推奨される API は social.following/stopfollowing です。

エンドポイント

/stopfollowingtag('<tag id>')

パラメーター

型: GUID
フォローを停止するタグの ID。REST を使用してタグ ID を取得することはできませんが、JavaScript オブジェクト モデルを使用してタグ ID を取得することや, .NET クライアント オブジェクト モデルを使用して取得することはできます。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.peoplemanager
    /stopfollowingtag('3e324ad0-de47-4c0a-b9c6-59fda8419430')",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

OData 表現

次の例は、JSON 形式による PeopleManager リソースを表します。

    {"d":{
      "__metadata":{,
        "id":"sp.userprofiles.peoplemanager",
        "uri":"http://<site url>/_api/sp.userprofiles.peoplemanager",
        "type":"SP.UserProfiles.PeopleManager"
      },
      "EditProfileLink":"https://domain-my.sharepoint.com:443/_layouts/15/EditProfile.aspx?UserSettingsProvider=dfb95e82%2D8132%2D404b%2Db693%2D25418fdac9b6&ReturnUrl=https%3A%2F%2Fdomain%2Esharepoint%2Ecom%2F%5Fapi%2Fsp%2Euserprofiles%2Epeoplemanager",
      "IsMyPeopleListPublic":false
    }}

ProfileLoader のリソース

エンドポイント URI  |  メソッド

メソッドを直接呼び出す代わりに、別のエントリ ポイントをユーザー プロファイルに提供します。

エンドポイント URI

POST http://<site url>/_api/sp.userprofiles.profileloader.getprofileloader

サポートされる HTTP メソッド

POST

ProfileLoader メソッド

CreatePersonalSiteEnqueueBulk
GetOwnerUserProfile
GetProfileLoader
GetUserProfile

CreatePersonalSiteEnqueueBulk メソッド

1 人以上のユーザーの個人用サイトをプロビジョニングします。(SharePoint Online の 個人用サイト管理者のみ)

エンドポイント

/createpersonalsiteenqueuebulk

要求の例で示すように、この要求は、個人用サイト管理者によって SharePoint Online 管理センター サイトに送信される必要があります。

パラメーター

emailIDs

型: Collection(String)
サイトのプロビジョニングに使用されるユーザーの電子メール アドレス。最大 200 文字。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "https://<domain>-admin.sharepoint.com/_api/sp.userprofiles.profileloader.getprofileloader
    /createpersonalsiteenqueuebulk",
  type: "POST",
  data: "{ 'emailIDs': ['usera@domain.onmicrosoft.com', 'userb@domain.onmicrosoft.com'] }",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

GetOwnerUserProfile メソッド

サイト所有者のユーザー プロファイルを取得します。静的メソッドです。

エンドポイント

/sp.userprofiles.profileloader.getowneruserprofile

パラメーター

なし

HTTP method

POST

応答

型: SP.UserProfiles.UserProfile
サイト所有者のユーザー プロファイル。

要求の例

$.ajax({
  url: "http://<site url>/_api
    /sp.userprofiles.profileloader.getowneruserprofile",
  type: "POST",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

GetProfileLoader メソッド

コンテキスト キャッシュから ProfileLoader オブジェクトを取得します。静的メソッドです。

このエンドポイントを使用して、CreatePersonalSiteEnqueueBulk メソッドと GetUserProfile メソッドにアクセスします。

エンドポイント

/sp.userprofiles.profileloader.getprofileloader

パラメーター

なし

HTTP method

POST

応答

型: SP.UserProfiles.ProfileLoader
コンテキスト キャッシュからのProfileLoader オブジェクト。

要求の例

$.ajax({
  url: "http://<site url>/_api
    /sp.userprofiles.profileloader.getprofileloader",
  type: "POST",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

GetUserProfile メソッド

現在のユーザーに対応するユーザー プロファイルを取得します。静的メソッドです。

エンドポイント

/getuserprofile

パラメーター

なし

HTTP method

POST

応答

型: SP.UserProfiles.UserProfile
現在のユーザーのユーザー プロファイル。

要求の例

$.ajax({
  url: "http://<site url>/_api/sp.userprofiles.profileloader.getprofileloader
    /getuserprofile
  type: "POST",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

UserProfile のリソース

エンドポイント URI  |  プロパティ  |  メソッド  |  OData 表現

ユーザーのクライアント側のユーザー プロファイルを表します。

エンドポイント URI

POST http://<site url>/_api/sp.userprofiles.profileloader.getprofileloader/getuserprofile

サポートされる HTTP メソッド

POST

要求の例

現在のユーザーのユーザー プロファイルを取得します。

$.ajax({
  url: "http://<site url/_api/sp.userprofiles.profileloader.getprofileloader
    /getuserprofile",
  type: "POST",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

ユーザー プロファイルのプロパティ

プロパティを取得するには、次の例に示すように、POST 要求をプロパティ エンドポイントに送信します。

$.ajax({
  url: "http://<site url/_api/sp.userprofiles.profileloader.getprofileloader
    /getuserprofile/<property name>",
  type: "POST",
  headers: {
    "X-RequestDigest": <form digest value>,
    "accept": "application/json;odata=verbose"
  },
  success: successHandler,
  error: errorHandler
});

ユーザー プロファイルは ProfileLoader リソースを使用して取得されるため、UserProfile リソースに対するすべての要求は POST 要求として送信する必要があります。

プロパティ

R/W

リソースとともに返される

説明

FollowedContent

FollowedContent

R

いいえ

ユーザーの FollowedDocumentsUrl と FollowedSitesUrl を含むオブジェクト。

AccountName

String

R

はい

ユーザーのアカウント名。 (SharePoint Online のみ)

DisplayName

String

R

はい

ユーザーの表示名。 (SharePoint Online のみ)

O15FirstRunExperience

Int32

R

はい

ユーザーの FirstRun フラグ。(SharePoint Online のみ)

PersonalSite

SP.Site

R

いいえ

ユーザーの個人用サイト。

PersonalSiteCapabilities

Int32

R

はい

ユーザーの個人用サイトの機能。ビット単位の PersonalSiteCapabilities の値を表します。なし = 0、Profile 値 = 1、Social 値 = 2、Storage 値 = 4、MyTasksDashboard 値 = 8、Education 値 = 16、Guest 値 = 32。

PersonalSiteFirstCreationError

String

R

はい

ユーザーの個人用サイトが最初に作成されたときにスローされたエラーがある場合は、そのエラー。 (SharePoint Online のみ)

PersonalSiteFirstCreationTime

DateTime

R

はい

ユーザーの個人用サイトが最初に作成された日時。 (SharePoint Online のみ)

PersonalSiteInstantiationState

Int32

R

はい

個人用サイトのインスタンス化状態のステータス。インスタンス化状態値の一覧については, .NET クライアント オブジェクト モデルの「PersonalSiteInstantiationState」を参照してください。

PersonalSiteLastCreationTime

DateTime

R

はい

ユーザーの個人用サイトが最後に作成された日時。 (SharePoint Online のみ)

PersonalSiteNumberOfRetries

Int32

R

はい

ユーザーの個人用サイトの作成が試行された回数。(SharePoint Online のみ)

PictureImportEnabled

Boolean

R

はい

ユーザーの画像が Exchange からインポートされたかどうかを示す Boolean 値。

PublicUrl

String

R

はい

現在のユーザーの個人用サイトの公開 URL。(SharePoint Online のみ)

UrlToCreatePersonalSite

String

R

はい

ユーザーの個人用サイトの作成に使用する URL。

UserProfile メソッド

CreatePersonalSiteEnque
ShareAllSocialData

CreatePersonalSiteEnque メソッド

ドキュメント、Web ページやその他のファイルの共有に使用できる、このユーザーの個人用サイトの作成をキューに入れます。

SharePoint Online の開発では、個人用サイトのホストの管理者は、CreatePersonalSiteEnqueueBulk メソッドを使用して、1 人以上のユーザーの個人用サイトを作成することもできます。

エンドポイント

/createpersonalsiteenque

パラメーター

型: Boolean
インタラクティブに (Web) 開始される要求の場合は true 、非インタラクティブに (クライアント) 開始される要求の場合は false。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url/_api/sp.userprofiles.profileloader.getprofileloader
    /getuserprofile/createpersonalsiteenque(true)",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

ShareAllSocialData メソッド

このプロファイルのプライバシー設定を設定します。

エンドポイント

/createpersonalsiteenque

パラメーター

型: Boolean
すべてのソーシャル データを公開する場合は true、すべてのソーシャル データを非公開にする場合は false。

HTTP method

POST

応答

なし

要求の例

$.ajax({
  url: "http://<site url/_api/sp.userprofiles.profileloader.getprofileloader
    /getuserprofile/shareallsocialdata(true)",
  type: "POST",
  headers: { "X-RequestDigest": <form digest value> },
  success: successHandler,
  error: errorHandler
});

OData 表現

次の例は、JSON 形式による UserProfile リソースを表します。

    {"d":{
      "__metadata":{,
        "id":"https://<site url>/_api/sp.userprofiles.profileloader.getprofileloader/getuserprofile",
        "uri":"https://<site url>/_api/sp.userprofiles.profileloader.getprofileloader/getuserprofile",
        "type":"SP.UserProfiles.UserProfile"
      },
      "FollowedContent":{"__deferred":{"uri":"https://<site url>/_api/sp.userprofiles.profileloader.getprofileloader/getuserprofile/FollowedContent"}},
      "PersonalSite":{"__deferred":{"uri":"https://<site url>/_api/sp.userprofiles.profileloader.getprofileloader/getuserprofile/PersonalSite"}},
      "AccountName":"i:0#.f|membership|user@domain.onmicrosoft.com",
      "DisplayName":"User Name",
      "O15FirstRunExperience":16,
      "PersonalSiteCapabilities":14,
      "PersonalSiteFirstCreationError":"Personal Site already exists.",
      "PersonalSiteFirstCreationTime":"2014-03-23T17:37:48",
      "PersonalSiteInstantiationState":2,
      "PersonalSiteLastCreationTime":"2014-03-23T17:38:34",
      "PersonalSiteNumberOfRetries":2,
      "PictureImportEnabled":true,
      "PublicUrl":"https://domain-my.sharepoint.com:443/Person.aspx?accountname=i%3A0%23%2Ef%7Cmembership%7Cuser%40domain%2Eonmicrosoft%2Ecom",
      "UrlToCreatePersonalSite":"https://domain-my.sharepoint.com/personal/user_domain_onmicrosoft_com/"
    }}

ユーザープロファイルに関連する REST 応答で返される SP.UserProfiles リソース

SP.UserProfiles 名前空間からの次の REST リソースが、ユーザー プロファイルに関連する REST 要求に対するサーバーの応答で返されます。

HashTag

トレンド タグのコレクションのハッシュ タグを表します。

プロパティ

種類

説明

Name

String

ハッシュ タグの内部名。この名前は次の構成要素で作成されます。プレフィックス L0|#0 + タグ ID + 文字 | + タグ名。
例: L0|#03e324ad0-de47-4c0a-b9c6-59fda8419430|#tagname

UseCount

Int64

ハッシュ タグが使用される回数。

HashTagCollection

ミニブログの投稿に含まれるハッシュ タグのコレクションを表します。このコレクションは、GetTrendingTags メソッドから返されます。

プロパティ

種類

説明

Items

Collection(SP.UserProfiles.HashTag)

コレクション内のハッシュ タグ。

PersonProperties

ユーザー プロパティを表します。

プロパティ

種類

説明

AccountName

String

ユーザーのアカウント名。

DirectReports

Collection(String)

ユーザーの直属部下のアカウント名。

DisplayName

String

ユーザーの表示名。

Email

String

ユーザーの電子メール アドレス。

ExtendedManagers

Collection(String)

ユーザーのマネージャー階層のアカウント名。

ExtendedReports

Collection(String)

ユーザーの直属以外の部下のアカウント名。

IsFollowed

Boolean

ユーザーが現在のユーザーによってフォローされているかどうかを示す Boolean 値。

LatestPost

String

ユーザーの最新のミニブログの投稿。

Peers

Collection(String)

ユーザーの同僚のアカウント名。

PersonalUrl

String

ユーザーの個人用サイトの絶対 URL。

PictureUrl

String

ユーザーのプロファイル画像の URL。

Title

String

ユーザーの役職。

UserProfileProperties

Collection(SP.KeyValue)

ユーザーのユーザー プロファイル プロパティ。

UserUrl

String

ユーザーのプロファイル ページの URL。

実装メモ

ユーザーのアカウント名の形式は、表 1 に示すように、SharePoint 環境により異なります。

表 1. アカウント名の形式

SharePoint 環境

アカウント名の形式例

クエリ文字列で別名を使用してアカウント名を渡す方法

フォームを使用した SharePoint Online、または
SharePoint 2013 オンプレミス

i:0#.f|membership|user@domain.com

…/<method>(@v)?@v='i%3A0%23.f%7Cmembership%7Cuser%40domain.onmicrosoft.com'

Windows クレームを使用した SharePoint 2013 オンプレミス

i:0#.w|domain\user

…/<method>(@v)?@v='i%3A0%23.w%7Cdomain\user'

SAML クレームを使用した SharePoint 2013 オンプレミス

i:05:t|adfs with roles|user@domain.com

…/<method>(@v)?@v='i%3A05%3At%7Cadfs+with+roles%7Cuser%40domain.com'

注意

SAML (Security Assertion Markup Language) ベースのクレーム認証の例で使用するログイン名の形式は、ID クレームで電子メール アドレスまたはユーザー プリンシパル名を使用するように構成されていることを前提としています。SAML クレーム認証は、SharePoint ホスト型アプリでは使用できません。

その他の技術情報