How to post photo to album in facebook graph api Asp.NET -


I wrote an application for Facebook but I could not upload an image to the album I created, the code is below Thanks, your help Facebook.FacebookAPI api = New Facebook.FacebookAPI (GetAccessToken ()); Dictionary & lt; String, string & gt; Album = New Dictionary & lt; String, string & gt; (); Album. Add ("name", "test album"); Album. Add ("message", "message is here!"); JSONObject Results = api.Post ("me / album", album); String AlbumId = result.Dictionary ["id"]. String; Dictionary & lt; String, string & gt; Photo = New Dictionary & lt; String, string & gt; (); Photo. Add ("Message", "Test Message"); Photo.Add ("source", "tgw.jpg"); JSONObject photoResult = api.Post ("/" + album id + "/ photo", photo);

Does this work for you? String Photospath = @ ".. \ .. \ .. \ Facebook.Tests \ bin \ release \ monkey.jpg"; String albumId = ConfigurationManager.AppSettings ["AlbumId"]; Byte [] Photo = file. Read AllBytes (photoPath); Facebook app = new Facebook app (); Dynamic parameters = new ExpandoObject (); Parameters.access_token = ConfigurationManager.AppSettings ["AccessToken"]; Parameters.message = "This is a test photo of a monkey that has been uploaded" + "using the Facebook C # SDK (" http://facebooksdk.codeplex.com "" + "Graph API)"; Var mediaObject = new FacebookMediaObject {FileName = "monkey.jpg", content type = "image / jpeg",}; MediaObject.SetValue (photo); Parameters.source = mediaObject; Dynamic Results = App API (string.format ("/ {0} / photo", album id), criteria, http meth.post); Taken from



Comments