日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SharePoint 2013 开发——其他社交功能

發布時間:2023/12/1 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SharePoint 2013 开发——其他社交功能 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

博客地址:http://blog.csdn.net/FoxDave

上一篇講了如何獲取用戶配置文件的相關屬性,它屬于SharePoint 2013社交功能的一個小的構成部分。社交功能是SharePoint 2013改進的一大亮點。可以在現有網站上開啟社交功能或者新建一個專門用于社交用途的社區網站,社交功能包括關注(人或內容)、艾特@、#等功能、有清晰的用戶積分制度等等。由于工作中不會有太多關于這方面的開發需求,并且個人覺得這部分做得挺不錯,基本的需求應該是夠用了(強大的或許就不在SharePoint上了),所以本篇只會用兩個小例子展示一下如何用客戶端對象模型與SharePoint社交功能進行交互來說明SharePoint 2013社交功能的開發,當然不僅限于客戶端對象模型,JSOM和REST也可以做類似的事情。

包括之前提到的用戶配置文件相關的開發,在用客戶端對象模型做社交相關功能的代碼交互開發時,需要引入Microsoft.SharePoint.Client、Microsoft.SharePoint.ClientRuntime和Microsoft.SharePoint.Client.UserProfiles這三個程序集,并在代碼文件頭部增加如下兩個引用:

using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.Social;

首先構建上下文對象:

ClientContext clientContext = new ClientContext("<你的網站URL>");

在Microsoft.SharePoint.Client.Social這個命名空間下,有SocialFeedManager、SocialFeedOptions、SocialPostCreationData和SocialFollowingManager等對象模型可供我們使用,分別跟訂閱、回帖、關注等有關。

獲取指定用戶的動態:

SocialFeedManager feedManager = new SocialFeedManager(clientContext);SocialFeedOptions feedOptions = new SocialFeedOptions();feedOptions.MaxThreadCount = 10;ClientResult<SocialFeed> feed = feedManager.GetFeedFor("<指定的用戶>", 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);}

獲得指定用戶關注和被關注的人:

static void Main(string[] args){string serverUrl = "<你的網站URL>";string targetUser = "<指定的用戶>";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("當前用戶關注的人數: ({0})", followedCount.Value);IterateThroughPeople(followedResult.Value);Console.WriteLine("\n誰關注此用戶:");IterateThroughPeople(followersResult.Value);Console.ReadKey();}static void IterateThroughPeople(SocialActor[] actors){foreach (SocialActor actor in actors){Console.WriteLine(" - {0}", actor.Name);Console.WriteLine("\t鏈接: {0}", actor.PersonalSiteUri);Console.WriteLine("\t頭像: {0}", actor.ImageUri);}}

更多內容請參考微軟MSDN文檔,寫得還是很詳細清晰的,如果我們在工作中遇到了相關內容的任務,能夠提供很有力的參考和幫助。

轉載于:https://www.cnblogs.com/justinliu/p/5961609.html

總結

以上是生活随笔為你收集整理的SharePoint 2013 开发——其他社交功能的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。