Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,
I'm working on a C# winform application to upload images to existing albums in Facebook. I can login/out successfully. Can get the available albums and their IDs. But when I upload photo, it gives this error - (OAuthException - #200) (#200) Permissions error on fb.Post() method.
Please help me to figure this out.
Thanks

C#
var fb = new FacebookClient(_accessToken);

string photoAlbumID = lstBoxAlbums.SelectedValue.ToString();
string temp = lstBoxAlbums.SelectedItem.ToString();

FacebookMediaObject picToUpload =
     new FacebookMediaObject
     {
         FileName = lblFolderPath.Text + "\\" + lstBoxPics.SelectedItem.ToString(),
             ContentType = "image/jpg"
     };


var bytes = System.IO.File.ReadAllBytes(picToUpload.FileName);
picToUpload.SetValue(bytes);

var postInfo = new Dictionary<string, object>();
postInfo.Add("message", "test photo");
postInfo.Add("@file.jpg", picToUpload);
postInfo.Add("access_token", _accessToken);
postInfo.Add("scope", "publish_actions");
postInfo.Add("name", "Picture No 1");

var fbResult = fb.Post("/" + photoAlbumID + "/photos", postInfo);
dynamic result = (IDictionary<string, object>)fbResult;


PS:
when log in I use these permissions.
C#
private const string _ExtendedPermissionsNeeded = "email,offline_access,user_photos,photo_upload,publish_actions,publish_stream ";
Posted
Updated 12-Aug-14 20:15pm
v3
Comments
ZurdoDev 13-Aug-14 9:57am    
Facebook should be the one to help you figure it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900