1

I am following this post to post photo on my page from some other page using Facebook C# SDK

Post

When I am trying to create FacebookMediaObject then I am getting error as

"The given path's format is not supported."

My code is this:

parameters.source = new FacebookMediaObject
                {
                    ContentType = "image/png",
                    FileName = Path.GetFileName(ab.picture)
                }.SetValue(System.IO.File.ReadAllBytes(ab.picture));

I know why I am getting this error because ab.picture is an image hosted on facebook (e.g. https://fbcdn-photos-h-a.akamaihd.net/hphotos-ak-frc3/t1.0-0/10375041_921810831169221_8715777431539280147_s.png) & not absolute path. But I only have image on this path.

Is there any way to pass this image directly to FacebookMediaObject & post photo on my page ?

Syed Farjad Zia Zaidi
  • 3,302
  • 4
  • 27
  • 50
vaibhav shah
  • 4,939
  • 19
  • 58
  • 96
  • You know that / this is a escape sequence. You have to use // to pass the correct address in string. – Syed Farjad Zia Zaidi May 21 '14 at 21:21
  • 1
    Found simple solution to my problem. I just used solution given in this post : http://stackoverflow.com/questions/4599686/image-to-byte-array-from-a-url to read image online & passed it SetValue() function. – vaibhav shah May 21 '14 at 21:24

0 Answers0