Open Visual Studio in your system
Select Console Applciation template and give as name .
Replace Program.cs with the source code
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.SharePoint.Client;
- using Microsoft.SharePoint.Client.Social;
- namespace EmbedVideoInPost
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Replace the following placeholder values with the actual values.
- const string serverUrl = "http://gauti.sharepoint.com/sp";
- const string videoUrl = "http://gauti.sharepoint.com/Asset%20Library/fileName?Web=1";
- try
- {
- // Get the context and the SocialFeedManager instance.
- ClientContext clientContext = new ClientContext(serverUrl);
- SocialFeedManager feedManager = new SocialFeedManager(clientContext);
- // Get the video attachment from the server.
- ClientResult<SocialAttachment> attachment = feedManager.GetPreview(videoUrl);
- clientContext.ExecuteQuery();
- // Define properties for the post and add the attachment.
- SocialPostCreationData postCreationData = new SocialPostCreationData();
- postCreationData.ContentText = "Look at this!";
- postCreationData.Attachment = attachment.Value;
- // 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();
- Console.Write("The post was published.");
- Console.ReadLine();
- }
- catch (Exception ex)
- {
- Console.Write("Error publishing the post: " + ex.Message);
- Console.ReadLine();
- }
- }
- }
- }

Gowtham RajamanickamPosted Jul 3, 2015, 6:08 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Gowtham RajamanickamPosted Jul 3, 2015, 6:07 AM
Thank u
Vijay SPosted Jun 17, 2015, 9:10 AM
Good one