Follow people in SharePoint 2013

SharePoint 2013

Learn about common programming tasks for following people in SharePoint Server 2013.

When a user follows people in SharePoint Server 2013, microblog posts that the people publish and notifications about their activities show up in the user's newsfeed. The features related to following people can be seen on the Newsfeed and People I'm following pages.

SharePoint Server 2013 provides the following APIs that you can use to programmatically follow people:

  • Client object models for managed code

    • .NET client object model

    • Silverlight client object model

    • Mobile client object model

  • JavaScript object model

  • Representational State Transfer (REST) service

  • Server object model

As a best practice in SharePoint 2013 development, use client APIs when you can. Client APIs include the client object models, a JavaScript object model, and a REST service. For more information about the APIs in SharePoint 2013 and when to use them, see Choose the right API set in SharePoint 2013.

Each API includes a manager object that you use to perform core tasks for following people.

Note Note

The same APIs are used to follow content. See Follow content in SharePoint 2013 for an overview of Following Content tasks.

Table 1 shows the manager and other key objects (or REST resources) in the APIs and the class library (or access point) where you can find them.

Note Note

The Silverlight and mobile client object models are not explicitly included in Table 1 or Table 2 because they provide the same core functionality as the .NET client object model and use the same signatures. The Silverlight client object model is defined in Microsoft.SharePoint.Client.UserProfiles.Silverlight.dll, and the mobile client object model is defined in Microsoft.SharePoint.Client.UserProfiles.Phone.dll.

Table 1. SharePoint 2013 APIs used for following people programmatically

.NET client object model

See: How to: Follow people by using the .NET client object model in SharePoint 2013

Manager object:
SocialFollowingManager

Primary namespace:
Microsoft.SharePoint.Client.Social

Other key objects:
SocialActor, SocialActorInfo, SocialActorType, SocialActorTypes

Class library:
Microsoft.SharePoint.Client.UserProfiles.dll

JavaScript object model

See: How to: Follow people by using the JavaScript object model in SharePoint 2013

Manager object:
SocialFollowingManager

Primary namespace:
SP.Social

Other key objects:
SocialActor, SocialActorInfo, SocialActorType, SocialActorTypes

Class library:
SP.UserProfiles.js

REST service

See: Following people and content REST API reference for SharePoint 2013

Manager resource:
social.following

Endpoint URI:
<siteUri>/_api/social.following

Primary namespace (OData):
sp.social.SocialRestFollowingManager

Other key resources:
SocialActor, SocialActorInfo, SocialActorType, SocialActorTypes

Server object model

Manager object:
SPSocialFollowingManager

Primary namespace:
Microsoft.Office.Server.Social

Other key objects:
SPSocialActor, SPSocialActorInfo, SPSocialActorType, SPSocialActorTypes

Class library:
Microsoft.Office.Server.UserProfiles.dll

Table 2 shows common programming tasks for following people and the members that you use to perform them. Members are from the .NET client object model (CSOM), JavaScript object model (JSOM), REST service, and server object model (SSOM).

Note Note

The same APIs are used to follow content. See Follow content in SharePoint 2013 for an overview of Following Content tasks.

The SocialFollowingManager object consolidates the core Following People and Following Content functionality for the current user. However, the PeopleManager object (see Table 3) provides some functionality that SocialFollowingManager does not provide, including methods to obtain the Following People status of other users.

Table 2. API for common tasks for following people by using the SocialFollowingManager object

Task

Members

Create an instance of a manager object in the context of the current user

CSOM: SocialFollowingManager

JSOM: SocialFollowingManager

REST: <siteUri>/_api/social.following

SSOM: SPSocialFollowingManager

Create an instance of a manager object in the context of a particular user

CSOM: not implemented

JSOM: not implemented

REST: not implemented

SSOM: SPSocialFollowingManager (overloaded)

Have the current user start following (stop following) someone

CSOM: Follow (StopFollowing)

JSOM: follow (stopFollowing)

REST: Follow (StopFollowing)
  POST <siteUri>/_api/social.following/Follow (<siteUri>/_api/social.following/StopFollowing) and pass the actor parameter in the request body

SSOM: Follow (StopFollowing)

Find out whether the current user is following a particular user

CSOM: IsFollowed

JSOM: isFollowed

REST: IsFollowed
  POST <siteUri>/_api/social.following/my/IsFollowed and pass the actor parameter in the request body

SSOM: IsFollowed

Get the people who are following the current user

CSOM: GetFollowers

JSOM: getFollowers

REST: Followers
  GET <siteUri>/_api/social.following/my/Followers

SSOM: GetFollowers

Get the people who the current user is following

CSOM: GetFollowed

JSOM: getFollowed

REST: Followed
  GET <siteUri>/_api/social.following/my/Followed(types=1)

SSOM: GetFollowed

Get the count of people who the current user is following

CSOM: GetFollowedCount

JSOM: getFollowedCount

REST: FollowedCount
  GET <siteUri>/_api/social.following/my/FollowedCount(types=1)

SSOM: GetFollowedCount

Get the people who the current user might want to follow

CSOM: GetSuggestions

JSOM: getSuggestions

REST: Suggestions
  GET <siteUri>/_api/social.following/my/Suggestions

SSOM: GetSuggestions

Table 3 shows the PeopleManager members that you can use for additional Following People functionality.

Table 3. API for common tasks for following people by using the PeopleManager object

Task

Members

Find out whether the People I'm Following list for the current user is public

CSOM: IsMyPeopleListPublic

JSOM: isMyPeopleListPublic

REST: IsMyPeopleListPublic
  GET <siteUri>/_api/SP.UserProfiles.PeopleManager/IsMyPeopleListPublic

SSOM: IsMyPeopleListPublic

Find out whether someone is following the current user

CSOM: AmIFollowedBy

JSOM: amIFollowedBy

REST: AmIFollowedBy
  GET <siteUri>/_api/SP.UserProfiles.PeopleManager/AmIFollowedBy(accountName=@v)?@v='domain\\user'

SSOM: AmIFollowedBy

Get the people who a particular user is following

CSOM: GetPeopleFollowedBy

JSOM: getPeopleFollowedBy

REST: GetPeopleFollowedBy
  GET <siteUri>/_api/SP.UserProfiles.PeopleManager/GetPeopleFollowedBy(accountName=@v)?@v='domain\\user'

SSOM: GetPeopleFollowedBy

Get the people who are following a particular user

CSOM: GetFollowersFor

JSOM: getFollowersFor

REST: GetFollowersFor
  GET <siteUri>/_api/SP.UserProfiles.PeopleManager/GetFollowersFor(accountName=@v)?@v='domain\\user'

SSOM: GetFollowersFor

Find out whether a particular user is following another user

CSOM: IsFollowing

JSOM: isFollowing

REST: IsFollowing (static)
  GET <siteUri>/_api/SP_UserProfiles_PeopleManager_IsFollowing(possibleFollowerAccountName=@v,possibleFolloweeAccountName=@y)?@v='domain\\user'&@y='domain\\user'

SSOM: IsFollowing

Results for People Suggestions are based on established Following People activity. Suggestions are offered when a user is following someone who has a mutual following with someone else who the user is not already following.

Following-related information is indexed during search crawls. After a crawl is complete, search analytics must then analyze the crawled Following information and output user suggestions. By default, search analytics runs once per day.

When a user opens the People I'm following page, the PeopleManager.GetMySuggestions() method is called. GetMySuggestions searches for new suggestions for the current user, updates the user's suggestions in the database, and presents the suggestions on the page.

Show:
© 2014 Microsoft