SharePoint 2013 Development--other social features

Source: Internet
Author: User

Blog Address: Http://blog.csdn.net/FoxDave

The previous article describes how to get the related properties of a user profile, which is a small component of the social features of SharePoint 2013. Social features are a great highlight of SharePoint 2013 improvements. You can turn on social features on an existing website or create a new community site dedicated to social use, including attention (people or content), AI @, #等功能, a clear user loyalty system, and more. Because there is not much to do with the development of this aspect of the work, and personally feel that this part is doing a good job, the basic needs should be enough (strong maybe not on the SharePoint), So this article will only use two small examples to show how to use the client object model to interact with SharePoint social features to illustrate the development of SharePoint 2013 social features, not limited to the client object model, Jsom and rest can do similar things.

Including the previously mentioned user profile related development, in the client object model to do social-related functions of the Code interactive development, need to introduce Microsoft.SharePoint.Client, Microsoft.SharePoint.ClientRuntime and Microsoft.SharePoint.Client.UserProfiles These three assemblies, and add the following two references to the header of the code file:

Using microsoft.sharepoint.client;using Microsoft.SharePoint.Client.Social;

First build the context object:

ClientContext clientcontext = new ClientContext ("< your website url>");

Under the Microsoft.SharePoint.Client.Social namespace, there are Socialfeedmanager, Socialfeedoptions, Socialpostcreationdata and Socialfollowingmanager and other object models are available for us to use, respectively, with subscriptions, replies, concerns and so on.

Gets the dynamic of the specified user:

Socialfeedmanager Feedmanager = new Socialfeedmanager (clientcontext);            Socialfeedoptions feedoptions = new Socialfeedoptions ();            Feedoptions.maxthreadcount = ten;            Clientresult<socialfeed> feed = feedmanager.getfeedfor ("< specified user >", feedoptions);            Clientcontext.executequery ();            for (int i = 0; i < feed. Value.Threads.Length; i++)            {                Socialthread thread = feed. Value.threads[i];                String posttext = Thread. Rootpost.text;                Console.WriteLine ("\ T" + (i + 1) + "." + PostText);            }

Get the people you care about and are concerned about:

static void Main (string[] args) {string ServerURL = "< your website url>";            String Targetuser = "< specified user >";            ClientContext clientcontext = new ClientContext (ServerURL);            Socialfollowingmanager Followingmanager = new Socialfollowingmanager (clientcontext);            Socialactorinfo actorinfo = new Socialactorinfo ();            Actorinfo.accountname = Targetuser;            clientresult<int> Followedcount = Followingmanager.getfollowedcount (socialactortypes.users);            clientresult<socialactor[]> Followedresult = followingmanager.getfollowed (SocialActorTypes.Users);            clientresult<socialactor[]> Followersresult = Followingmanager.getfollowers ();            Clientcontext.executequery ();            Console.WriteLine ("Number of current user concerns: ({0})", Followedcount.value);            Iteratethroughpeople (Followedresult.value);            Console.WriteLine ("\ n who pays attention to this user:"); Iteratethroughpeople (Followersresult.value);        Console.readkey ();            } static void Iteratethroughpeople (socialactor[] actors) {foreach (Socialactor actor in actors) {Console.WriteLine ("-{0}", actor.                Name); Console.WriteLine ("\ t link: {0}", actor.)                Personalsiteuri); Console.WriteLine ("\ t Avatar: {0}", actor.)            Imageuri); }        }

For more information, please refer to Microsoft MSDN Documentation , the writing is still very detailed and clear, if we encountered in the work of the relevant content of the task, can provide a very strong reference and help. ??

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

SharePoint 2013 Development--other social features

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.