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

1 Answer 1

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/

1
  • Please do not post link only answers! Add some details from the link to the post Apr 9, 2014 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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