So I reset the permissions and now everything works properly*.
*What I was looking for was posting the photo on the page as the page. Right now the code above posts a photo on the page as a normal user.
题
I am trying to upload photo to a page I have created. Unfortunately it returns me the following exception - A first chance exception of type 'Facebook.FacebookOAuthException' occurred in Facebook.dll
.
You'd think that I have missed some permission in the "Graph API Explorer", but I have actually checked every single one of them and I am using that Access Token. Obviously the problem is connected to the Access Token, but I am not sure how.
Here is what I have tested and it works fine:
And yet when I try to post photos to my page album or to my page wall it returns me that exception.
I use the code from here:
FacebookClient facebookClient = new FacebookClient(accessToken);
dynamic parameters = new ExpandoObject();
parameters.access_token = accessToken;
parameters.source = new FacebookMediaObject
{
FileName = "My_Picture.jpg",
ContentType = "image/jpeg"
}.SetValue(File.ReadAllBytes(@"F:\\My_Picture.jpg"));
//"my" album ID is 12345
//page album id is 67890
facebookClient.Post("/67890/photos", parameters);
I have tried changing /photos
to /feed
, but it doesn't work either. I have also tried changing the 67890
(album ID) with my page name and page id.
I use VS 2013, C# with WPF, newest version of Facebook SDK C#.
解决方案
So I reset the permissions and now everything works properly*.
*What I was looking for was posting the photo on the page as the page. Right now the code above posts a photo on the page as a normal user.