Share via


SP へUserProfiles.PeopleManager.getPeopleFollowedByMe 方法 (sp.userprofiles)

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

**適用対象:**apps for SharePoint | Office 365 | SharePoint Foundation 2013 | SharePoint Server 2013

SP.UserProfiles.PeopleManager.getPeopleFollowedByMe()

戻り値

SP.ClientObjectList
PersonPropertiesオブジェクトの一覧で、現在のユーザーをフォローするユーザー。

注釈

このタスクを使用する推奨される API が、 SocialFollowingManager.getFollowedします。

次の例では、 getPeopleFollowedByMeメソッドを使用する方法とPersonPropertiesオブジェクトのリストを反復処理し、各ユーザーのDisplay Nameプロパティを取得する方法を示します。

この操作を実行するプロジェクトを設定する方法については、 SharePoint 2013 で JavaScript オブジェクト モデルを使用してユーザーをフォローする方法を参照してください。

var peopleFollowedByMe;

// Send the request to get followed people.
function getPeopleFollowedByCurrentUser() {

    // Get the current client context.
    var clientContext = SP.ClientContext.get_current();

    // Get the PeopleManager instance.
    var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);

    // Get the people who are followed by the target user.
    peopleFollowedByMe = peopleManager.getPeopleFollowedByMe();
    clientContext.load(peopleFollowedByMe);

    // Send the request to the server.
    clientContext.executeQueryAsync(iterateThroughResults, requestFailed)
}

// Get information from the returned list.
function iterateThroughResults() {
    var results = peopleFollowedByMe.getEnumerator();
    while (results.moveNext()) {
        var person = results.get_current();
        alert('The user is following ' + person.get_displayName());
    }
}

// Failure callback.
function requestFailed(sender, args) {
    alert('Error: ' + args.get_message());
}

関連項目

その他の技術情報

PeopleManager

SharePoint 2013 で他のユーザーをフォローする