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

How can I create a post for a document with SSOM

$
0
0

How can I create a post for a document with SSOM?

SPServiceContext serviceContext = SPServiceContext.Current;
UserProfileManager userProfileManager = new UserProfileManager(serviceContext, false);
string actorId = "2.0c3049bc1cde4bb8803b62a0b5ca2cc7.09f1c9bdaa3e40b2bf9039216a436457.f5630be70b23432ba31587a6b48759aa.0c37852b34d0418e91c62ac25af4be5b";
SPSocialFeedManager man = new SPSocialFeedManager(userProfileManager.GetUserProfile(false), serviceContext);
SPSocialThread thread = man.CreatePost(actorId, new SPSocialPostCreationData()
{
    ContentText = "Hello docs " + text,
    UpdateStatusText = false
});

When I use a socialActorId for a site "8.xxx.xxx.xxx.xxx" the post is created without problems, but when I try to create a post for a document "2.xxx.xxx.xxx.xxx" I get the following exception:

Microsoft.Office.Server.Social.SPSocialException: The operation is invalid for the target's current state.


Viewing all articles
Browse latest Browse all 25064

Trending Articles