如何使用SSOM喜欢/不同于sharepoint中的社交订阅源 [英] How to like /unlike social feed in sharepoint using SSOM

查看:115
本文介绍了如何使用SSOM喜欢/不同于sharepoint中的社交订阅源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我在尝试喜欢任何SPSocial Feed时遇到的问题。



Microsoft.Office.Server.Microfeed.MicrofeedException。内部错误代码:28 。



我的代码在控制台应用程序中运行完美但在webpart中不是:(



请查看示例代码以获取有关该问题的详细信息。



Below is the issue i am getting while try to like any SPSocial Feed.

"Microsoft.Office.Server.Microfeed.MicrofeedException. Internal error code: 28".

My Code is Working perfect in Console application but in webpart is't not :(

Please look into sample code to get detail about the issue.

const string siteUrl = "http://server/sites/sitename";
            const string user = "domain\\username";

            using (SPSite site = new SPSite(siteUrl))
            {
                SPUser userContext = site.RootWeb.SiteUsers[user];
                SPUserToken userToken = userContext.UserToken;

                SPServiceContext serviceContext = SPServiceContext.GetContext(site);

                using (new SPServiceContextScope(serviceContext))
                {

                    UserProfileManager profileManager = new UserProfileManager(serviceContext);

                    UserProfile userProfile = profileManager.GetUserProfile(userContext.LoginName);

                    SPSocialFeedManager feedManager = new SPSocialFeedManager(userProfile, serviceContext, userToken);

                    SPSocialPostCreationData post = new SPSocialPostCreationData();
                    post.ContentText = "Hi from server object model";

                    feedManager.CreatePost(site.Url+"/newsfeed.aspx", post);

                }
            }





我的尝试:



已经尝试过

SPSecurity.RunWithElevatedPrivileges

SPUtility.ValidateFormDigest();

WeB.Allowunsafeupdate



What I have tried:

Already tried with
SPSecurity.RunWithElevatedPrivileges
SPUtility.ValidateFormDigest();
WeB.Allowunsafeupdate

推荐答案

http://answers.flyppdevportal.com/MVC/Post/Thread/68b9fc7e -7e91-4416-a7df-eae48a207460?category = sharepointdevelopment





http://answers.flyppdevportal.com/MVC/Post/Thread/68b9fc7e-7e91-4416-a7df-eae48a207460?category=sharepointdevelopment


Quote:

仅供参考:今天我们在我们的服务器场中安装了SharePoint 2016年2月的CU。 (建立:15.0.4797.1000)



我们可以确认这种情况最终会再次起作用。

FYI: Today we installed the SharePoint February 2016 CU in our farm. (Build: 15.0.4797.1000)

And we can confirm that this is finally working again.


这篇关于如何使用SSOM喜欢/不同于sharepoint中的社交订阅源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆