Share Image on Facebook from WPF Application

Last Reply 10 months ago By dharmendr

Posted 10 months ago

Hi Mudassar Khan Sir,

I need to connect with facebook and share image after login,

I have done to connect with facebook using their api, but when i am going to post image it shows 200 error.

my code is given below : 

here fbtoken is facebook object.

string photoAlbumID = "199967900755629";

FacebookMediaObject facebookUploader = new FacebookMediaObject { FileName = "Carnival-Mask-Costume-Ideas-800x600.jpg", ContentType = "image/png" };

//var bytes = File.ReadAllBytes(System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName) + "\\" + facebookUploader.FileName);
var bytes = File.ReadAllBytes(@"D:\Gallery\Carnival-Mask-Costume-Ideas-800x600.jpg");

var postInfo = new Dictionary<string, object>();
postInfo.Add("message", "test photo");
postInfo.Add("image", facebookUploader);
postInfo.Add("access_token", fbtoken.AccessToken);
var fbResult = fbtoken.Post("/" + photoAlbumID + "/photos", postInfo);
dynamic result = (IDictionary<string, object>)fbResult;

I am getting the and url not proper hitting because the publish_action keyword is removed by facebook. please help me out, how can i post or share image from desktop application to facebook.

   "error": {
      "message": "Can't load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and sub-domains of your app to the App Domains field in your app settings.",
      "type": "OAuthException",
      "code": 191,
      "fbtrace_id": "EJuGhM1RWly"


You are viewing reply posted by: dharmendr 10 months ago.