Share Image on Facebook from WPF Application

Last Reply 9 months ago By dharmendr

Posted 9 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"


Posted 9 months ago

Use Graph API to share image. Refer below article.

Share Image, Photo Pictures on Facebook in ASP.Net using Graph API

Posted 9 months ago

Hi Dharmendra Sir,

Thankx, for this, But i am working on WCF Windows Application, Today i found why i am getting OAUTH Error #200, I need to add platform in facebook app,

When i am going to add, Window Store SID required after that i search about Window Store SID, It is Paid from Microsoft but i dont know i am on the right track or not

Because Once i purchased, if it wont work it will very expensive for me, if it is available for testing or developer to use then please share it or help me out.

One More Thing i found "WINSDKFb" in nuget package Manager but unable to install the package to check it works with my application or not.


Thankx Dharmendra Sir and ASP Forums Teams.