SharePoint 2013 obtains user and user attention information

Source: Internet
Author: User

SharePoint 2013 obtains user and user attention information

 

1. The person who follows the application

Static void getfollowedusers (string username, string siteurl)

{

Using (spsite site = new spsite (siteurl ))

{

Spservicecontextcontext = spservicecontext. getcontext (SITE );

Userprofilemanagerprofilemanager = new userprofilemanager (context );

If (profilemanager. userexists (username ))

{

Userprofileuserprofile = profilemanager. getuserprofile (username );

Spsocialfeedmanagerfeedmanager = new spsocialfeedmanager (USERPROFILE, context );

Spsocialfollowingmanagerfollowingmanager = new spsocialfollowingmanager (USERPROFILE, context );

Spsocialactor [] followed = followingmanager. getfollowed (spsocialactortypes. users );

Console. writeline ("followng :");

Foreach (VAR actor in followed)

{

Console. writeline (actor. accountname );

}

}

Else

{

Console. writeline (string. Format ("USERPROFILE for user {0} does not exist", username ));

}

}

}

2. Get the user's attention information:

Static void getfollower (string siteurl, string username)

{

Using (spsite site = new spsite (siteurl ))

{

Spservicecontextcontext = spservicecontext. getcontext (SITE );

Userprofilemanagerprofilemanager = new userprofilemanager (context );

If (profilemanager. userexists (username ))

{

Userprofileuserprofile = profilemanager. getuserprofile (username );

Spsocialfeedmanagerfeedmanager = new spsocialfeedmanager (USERPROFILE, context );

Spsocialfollowingmanagerfollowingmanager = new spsocialfollowingmanager (USERPROFILE, context );

Spsocialactor [] followers = followingmanager. getfollowers ();

Foreach (VAR actor in followers)

{

Console. writeline (actor. accountname );

}

}

Else

{

Console. writeline (string. Format ("USERPROFILE for user {0} does not exist", username ));

}

}

}

SharePoint 2013 obtains user and user attention information

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.