Hi
How to post Video in Facebook & twitter account using c#
Thanks
Hi
How to post Video in Facebook & twitter account using c#
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Daniel WrightRank #2,947 · 489 reputationPosted Apr 9, 2025, 9:30 PM EDT
Hi there! To post videos on Facebook and Twitter using C#, you can utilize their respective APIs. Here's a general outline of how you can achieve this:
1. Facebook:
- To post a video on Facebook using C#, you would need to first authenticate your application with Facebook's Graph API.
- You can then use the Graph API to upload the video file and create a post with the video on your Facebook account or page.
- Here is a simple example using the Facebook SDK for .NET:
FacebookClient fb = new FacebookClient("your_access_token"); dynamic parameters = new ExpandoObject(); parameters.source = new FacebookMediaObject { ContentType = "video/mp4", FileName = "video.mp4" }.SetValue(File.ReadAllBytes("path_to_video.mp4")); parameters.description = "Check out this video!"; dynamic result = fb.Post("me/videos", parameters);2. Twitter:
- For posting a video on Twitter using C#, you would similarly need to authenticate your application with the Twitter API.
- You can then upload the video file to Twitter using the media/upload endpoint and then create a Tweet with a reference to the uploaded video.
- Here is a simplified example using the Tweetinvi library:
var uploadedMedia = Upload.UploadBinary(File.ReadAllBytes("path_to_video.mp4")); var tweet = Tweetinvi.Tweet.PublishTweet("Check out this video!", new PublishTweetOptionalParameters { Medias = new List { uploadedMedia } });Remember to replace placeholders like "your_access_token", "path_to_video.mp4" with your actual credentials and file paths. This should give you a basic idea of how to post videos on Facebook and Twitter using C# through their APIs. Let me know if you need more specific details or further assistance!