Share via


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

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

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

SP.UserProfiles.PeopleManager.getMyFollowers()

戻り値

SP.ClientObjectList
PersonPropertiesオブジェクトのリストと現在のユーザーは、次のユーザー。

注釈

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

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

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

var peopleFollowingMe;

// Send the request to get followers.
function getPeopleFollowingCurrentUser() {

    // 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 following the current user.
    peopleFollowingMe = peopleManager.getMyFollowers();
    clientContext.load(peopleFollowingMe);

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

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

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

関連項目

その他の技術情報

PeopleManager

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