Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Cannot create news feed post

$
0
0

Using SP2013 on premise with SSOM, I am try to create a post to the news feed. I don't have any problems with the news feed from the web UI and OOTB webparts that access it. The problem is when creating a post from custom code here is what I'm using:

var ctx = SPServiceContext.Current;
this.m_profileManager = new UserProfileManager(ctx);
var creationData = new SPSocialPostCreationData {
	ContentText = "Test post text",
	UpdateStatusText = false
};
this.m_socialFeedManager = new SPSocialFeedManager(this.Profile, ctx, SPContext.Current.Web.CurrentUser.UserToken);
var thread = this.m_socialFeedManager.CreatePost(null, creationData);


Using the same instance of SPSocialFeedManager created in the code above I can successfully read feeds and posts, but when calling CreatePost I get an exception. Is there something further I need to do to get this working? I've tried setting SPContext.Current.Web and SPContext.Current.Site AllowUnsafeUpdates property to true before calling CreatePost, but I still get the same error.

And here are the exception details:

The operation failed because an internal error occurred. Internal type name: Microsoft.Office.Server.Microfeed.MicrofeedException. Internal error code: 28.

MicroBlogList_Error_Updating_Item : ( The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. ) : Correlation ID:51830c9c-581a-4053-b411-7204b484ea93 : Date and Time : 3/29/2013 5:04:19 AM

   at Microsoft.Office.Server.Microfeed.SPMicrofeedPost.CommonPublishedMicroFeedListItemUpdate(Boolean bRetainModifiedTime)
   at Microsoft.Office.Server.Microfeed.SPMicrofeedPost.UpdatePublishedFeed(Boolean bRetainModifiedTime)
   at Microsoft.Office.Server.Microfeed.SPMicrofeedPost.Commit(Boolean bRetainModifiedTime)
   at Microsoft.Office.Server.Microfeed.SPMicrofeedThread.NewRootPost(SPMicrofeedPostOptions mfPostOptions)
   at Microsoft.Office.Server.Microfeed.SPMicrofeedManager.Post(SPMicrofeedPostOptions postOptions)
   at Microsoft.Office.Server.Social.SPSocialFeedManager.Microsoft.Office.Server.Social.ISocialFeedManagerProxy.ProxyCreatePost(String targetId, SPSocialPostCreationData creationData)
   at Microsoft.Office.Server.Social.SPSocialFeedManager.<>c__DisplayClass4b`1.<S2SInvoke>b__4a()
   at Microsoft.Office.Server.Social.SPSocialUtil.InvokeWithExceptionTranslation[T](ISocialOperationManager target, String name, Func`1 func)


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>