0

I am using .net client object model for MicroBlogging (Post with hashtags). I am getting access denied error.

i am using below code

   const string serverUrl = "http://usfkl13as133v:9191/en-US/";
                    const string tagName = "#" + "moss2007";

                    // Define the link to a tag that you want to include in the post. If the tag is new, the
                    // server adds it to the tags collection.
                    SocialDataItem tagLink = new SocialDataItem
                    {
                        ItemType = SocialDataItemType.Tag,
                        Text = tagName
                    };

                    // Add the tag to the post's creation data.
                    // Put a placeholder ({0}) where you want the tag to appear in the post text,
                    // and then add the tag to the post's content items.
                    SocialPostCreationData postCreationData = new SocialPostCreationData();
                    postCreationData.ContentText = "I like {0}.";
                    postCreationData.ContentItems = new SocialDataItem[1] { tagLink };

                    try
                    {

                        // Get the context and the SocialFeedManager instance.
                        ClientContext clientContext = new ClientContext(serverUrl);
                        SocialFeedManager feedManager = new SocialFeedManager(clientContext);

                        // Publish the post. This is a root post to the user's feed, so specify
                        // null for the targetId parameter.
                        feedManager.CreatePost(null, postCreationData);
                        clientContext.ExecuteQuery();

                    }
                    catch (Exception ex)
                    {

                    }
0

Please check the first comment in following articles. May be it helps..

http://blog.sharedove.com/adisjugo/index.php/2013/05/22/posting-on-sharepoint-2013-newsfeed-on-behalf-of-someone-else/

  • Please do not post link only answers! Add some details from the link to the post – Robert Lindgren Apr 9 '14 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.