通过代码获取sharepoint2010的“我喜欢(I like it)”、“标签(Tags and Notes)”、“记事本”以及“文档等级”活动内容
2012-08-02 11:52
399 查看
最近有个项目要实现:sharepoint2010的“我喜欢(Ilikeit)”、“标签(TagsandNots)”、“记事本”以及“文档等级”活动内容如何通过代码获取?
通过MSDN资料我们知道是通过UserProfiles获取的。
http://msdn.microsoft.com/en-us/library/microsoft.office.server.socialdata
看看UserProfile的结构图:
标签:我喜欢
打开一个文档库或列表,点击【我喜欢】,如下图:
点击后会产生一个标签活动,去个人站点下查看会看到如下图内容:
自定义标签
点击后会产生一个标签活动,去个人站点下查看会看到如下图内容:
记事本内容
去个人站点下查看会看到如下图内容:
文档等级活动
创建一个文档库,启用等级设置。如下图:
接着上传一个文档,打等级标记
代码部分:
得到标签的活动内容
得到记事本的活动内容
[code]stringcurrentSite="http://win-moss:8010/";;
[/code]
得到文档评星级的活动内容
[code]stringcurrentSite="http://win-moss:8010/";;
[/code]
通过MSDN资料我们知道是通过UserProfiles获取的。
看看UserProfile的结构图:
标签:我喜欢
打开一个文档库或列表,点击【我喜欢】,如下图:
点击后会产生一个标签活动,去个人站点下查看会看到如下图内容:
自定义标签
点击后会产生一个标签活动,去个人站点下查看会看到如下图内容:
记事本内容
去个人站点下查看会看到如下图内容:
文档等级活动
创建一个文档库,启用等级设置。如下图:
接着上传一个文档,打等级标记
代码部分:
//*****************************************************得到标签的活动内容
stringcurrentSite="http://win-moss:8010/";;
using(SPSiteaSite=newSPSite(currentSite))
{
SPServiceContextcurrentContext=SPServiceContext.GetContext(aSite);
//GettheUserProfileManagerfromSPServiceContext.
UserProfileManageruserProfMan=newUserProfileManager(currentContext);
//Getthecurrentuser.
stringuserName=Environment.UserDomainName+"\\"+Environment.UserName;
UserProfilecurrentUser=userProfMan.GetUserProfile(userName);
SocialTagManagermySocialTagManager=newSocialTagManager(currentContext);
//string[]colleagueAccountNames=newstring[currentUser.Colleagues.GetItems().GetLength(0)];
SocialTag[]mySocialTags=mySocialTagManager.GetTags(currentUser);
stringtemp=string.Empty;
foreach(SocialTagiteminmySocialTags)
{
temp+="||活动:"+item.Title+"||"+item.LastModifiedTime;
}
Console.WriteLine(temp);
temp="";
SocialTerm[]myTerms=mySocialTagManager.GetTerms(currentUser);
foreach(SocialTermiteminmyTerms)
{
temp+=">>标签:"+item.Term.Name;
}
Console.WriteLine(temp);
Console.Read();
}
得到记事本的活动内容
//*********************************************************得到记事本的活动内容
[code]stringcurrentSite="http://win-moss:8010/";;
using(SPSiteaSite=newSPSite(currentSite))
{
SPServiceContextcurrentContext=SPServiceContext.GetContext(aSite);
//GettheUserProfileManagerfromSPServiceContext.
UserProfileManageruserProfMan=newUserProfileManager(currentContext);
//Getthecurrentuser.
stringuserName=Environment.UserDomainName+"\\"+Environment.UserName;
UserProfilecurrentUser=userProfMan.GetUserProfile(userName);
SocialCommentManagersocialCommentManager=newSocialCommentManager(currentContext);
SocialComment[]allComments=socialCommentManager.GetComments(currentUser);
stringtemp=string.Empty;
foreach(SocialCommentiteminallComments)
{
temp+="||"+item.Title+item.Comment;
}
Console.WriteLine(temp);
Console.Read();
}
[/code]
得到文档评星级的活动内容
////*********************************************************得到文档评星级的活动内容
[code]stringcurrentSite="http://win-moss:8010/";;
using(SPSiteaSite=newSPSite(currentSite))
{
SPServiceContextcurrentContext=SPServiceContext.GetContext(aSite);
//GettheUserProfileManagerfromSPServiceContext.
UserProfileManageruserProfMan=newUserProfileManager(currentContext);
//Getthecurrentuser.
stringuserName=Environment.UserDomainName+"\\"+Environment.UserName;
UserProfilecurrentUser=userProfMan.GetUserProfile(userName);
SocialRatingManagersocialRatingManager=newSocialRatingManager(currentContext);
SocialRating[]allRatings=socialRatingManager.GetRatings(currentUser);
stringtemp=string.Empty;
foreach(SocialRatingiteminallRatings)
{
temp+="||"+item.Title+">>"+item.Rating;
}
Console.WriteLine(temp);
Console.Read();
}
[/code]
相关文章推荐
- phpcms-v9 --- 如何通过{pc}标签获取全站文章内容?
- js如何根据id获取标签内的值,以及如何通过id赋值
- sax解析 得到xml文档所有内容和获取指定标签的值
- 获取html字符串中第一张图片的路径以及获取html字符串中的文字内容(去掉标签)
- php编程实现获取excel文档内容的代码实例
- 使用所见即所得文本编辑器编辑文本存入数据库后通过ajax获取服务器json_encode的数据到前台,文本内容上边的html标签不解析
- php编程实现获取excel文档内容的代码实例
- 通过javascript获取浏览器窗口、文档主体的实际大小以及获取终端设备(屏幕显示器)的可用大小
- JAVAWEB开发之Session的追踪创建和销毁、JSP详解(指令,标签,内置对象,动作即转发和包含)、JavaBean及内省技术以及EL表达式获取内容的使用
- javascript通过选择器获取标签的内容的方法
- SSH笔记 在JSP页面中通过Java获取系统时间并赋值给当前页面标签完整代码
- 动态事创建的a标签上利用jq滑过元素执行事件通过ajax获取后台数据根据鼠标位置展示数据内容,鼠标离开消失
- 如何通过代码获取word文档使用的语言
- jquery通过id或name获取标签的值,以及简单的js正则表达式(笔记)
- jsp中插入java代码,并在当前页面获取值(也可在另一js种通过input标签id获取值)
- 通过shell获取文件内容并返回给代码
- JavaWeb将数据包装成JSON以及JSP通过ajax对JSON的获取与解析(代码实例)
- html基础研究(六)-通过标签子标签开与关、属性、内容以及嵌套来了解段落元素
- php获取页面指定标签内容的实现代码分享
- JavaWeb将数据包装成JSON以及JSP通过ajax对JSON的获取与解析(代码实例)