// This function handles the click of the [Post New] button.
 // Effectively it takes the text from the text box, and uses that
 // to create a new post. This is similar to the [Reply All] button,
 // with one key difference --- in the CreatePost method we pass in
 // null as we are not replying to an existing post. This effectively
 // instructs SharePoint to create a new post.
 protected void PostNew_Click(object sender, EventArgs e)
 {
     if (ReplyText.Text == string.Empty)
     {
         LoadPosts();
         errLabel.Text = "Please enter some text";
         return;
     }
     try
     {
         SPSocial.SocialFeedManager feedMngr;
         feedMngr = new SPSocial.SocialFeedManager(clientContext);
         var postCreationData = new SPSocial.SocialPostCreationData();
         postCreationData.ContentText = ReplyText.Text;
         // Publish the new post. This is where we'll use null so that a new post is created.
         feedMngr.CreatePost(null, postCreationData);
         clientContext.ExecuteQuery();
     }
     finally
     {
         errLabel.Text = "";
         // Update the tiles so that our newest post is rendered.
         LoadPosts();
         ReplyText.Text = "";
     }
 }
        // This function handles the click of the [Post New] button.
        // Effectively it takes the text from the text box, and uses that
        // to create a new post. This is similar to the [Reply All] button,
        // with one key difference --- in the CreatePost method we pass in
        // null as we are not replying to an existing post. This effectively
        // instructs SharePoint to create a new post.
        protected void PostNew_Click(object sender, EventArgs e)
        {
            if (ReplyText.Text == string.Empty)
            {
                LoadPosts();
                errLabel.Text = "Please enter some text";
                return;
            }
            try
            {
                SPSocial.SocialFeedManager feedMngr;
                feedMngr = new SPSocial.SocialFeedManager(clientContext);
                var postCreationData = new SPSocial.SocialPostCreationData();
                postCreationData.ContentText = ReplyText.Text;
                // Publish the new post. This is where we'll use null so that a new post is created.
                feedMngr.CreatePost(null, postCreationData);
                clientContext.ExecuteQuery();

            }
            finally
            {
                errLabel.Text = "";
                // Update the tiles so that our newest post is rendered.
                LoadPosts();
                ReplyText.Text = "";
            }
        }
 // This function handles the click of the [Reply All] button.
 // Effectively it takes the text from the text box, and uses that
 // to reply to the posts with IDs that are contained in the postIds
 // list. That is, the three most recent posts as currently displayed
 // as tiles in the UI.
 protected void ReplyNow_Click(object sender, EventArgs e)
 {
     if (ReplyText.Text == string.Empty)
     {
         LoadPosts();
         errLabel.Text = "Please enter some text";
         return;
     }
     try
     {
         SPSocial.SocialFeedManager feedMngr;
         feedMngr = new SPSocial.SocialFeedManager(clientContext);
         foreach (string postId in postIds)
         {
             var postCreationData = new SPSocial.SocialPostCreationData();
             postCreationData.ContentText = ReplyText.Text;
             // Publish the reply. Note that the postId is the identifier of the post that we
             // want to reply to.
             feedMngr.CreatePost(postId, postCreationData);
             clientContext.ExecuteQuery();
         }
     }
     finally
     {
         errLabel.Text = "";
         // Update the tiles so that our replies are rendered for each post.
         LoadPosts();
         ReplyText.Text = "";
     }
 }
 // This function handles the click of the [Reply All] button.
 // Effectively it takes the text from the text box, and uses that
 // to reply to the posts with IDs that are contained in the postIds
 // list. That is, the three most recent posts as currently displayed
 // as tiles in the UI.
 protected void ReplyNow_Click(object sender, EventArgs e)
 {
     if (ReplyText.Text == string.Empty)
     {
         LoadPosts();
         errLabel.Text = "Please enter some text";
         return;
     }
     try
     {
         SPSocial.SocialFeedManager feedMngr;
         feedMngr = new SPSocial.SocialFeedManager(clientContext);
         foreach (string postId in postIds)
         {
             var postCreationData = new SPSocial.SocialPostCreationData();
             postCreationData.ContentText = ReplyText.Text;
             // Publish the reply. Note that the postId is the identifier of the post that we
             // want to reply to.
             feedMngr.CreatePost(postId, postCreationData);
             clientContext.ExecuteQuery();
         }
     }
     finally
     {
         errLabel.Text = "";
         // Update the tiles so that our replies are rendered for each post.
         LoadPosts();
         ReplyText.Text = "";
     }
 }