How to publish a post to the Office 365 SharePoint 2013 Social Feed using Client Object Model (CSOM)

In this article, I’ll explain on how to post to Office 365 SharePoint Social Feed using .NET Client Object Model (CSOM).

Step1  Create a Console application by name ‘PublishToSocialFeed’

Step2 Add references to the following assemblies


Step3 Add references to the following assemblies

using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Social


Create a Public Function by name ‘PublishPost’ and add the following snippet of code.

public static void PublishPost()
           Uri oUri = new Uri(“”);

           Office365ClaimsHelper claimsHelper = new Office365ClaimsHelper(oUri, “”, “yourpassword”);
           using (ClientContext oClientContext = new ClientContext(oUri))
               oClientContext.ExecutingWebRequest += claimsHelper.clientContext_ExecutingWebRequest;

               SocialFeedManager oSocialFeedManager = new SocialFeedManager(oClientContext);
               //Create an instance of Social Data Item object
               SocialDataItem oSocialDataItem = new SocialDataItem();
               oSocialDataItem.ItemType = SocialDataItemType.Link;
               oSocialDataItem.Text = “Google”;
               oSocialDataItem.Uri = “”;

               //Create an instance of Social Post Creation Data
               SocialPostCreationData oSocialPostCreationData = new SocialPostCreationData();
               oSocialPostCreationData.ContentText = “This is my first post”;

               oSocialFeedManager.CreatePost(null, oSocialPostCreationData);

               Console.WriteLine(“Published a news feed”);

To know more about ‘Office 365 Helper’ class and active authentication for Office 365, please refer to Wictor Wilen’s article.

 Subscribe to my blog

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.