发布后的Facebook C#SDK不在墙上发布
问题描述:
我正在使用Facebook C#SDK实现朋友墙"上的帖子,我为本地主机和发布服务器制作了单独的FB应用程序,出现的问题是它在我的本地主机上运行正常,但是当我运行发布时该站点不是在墙上发布,而是在墙上成功显示(如果墙上发布成功,则显示消息)我正在正确提供AppID和AppSecret,这是我在朋友墙上发布的代码.
I am implementing Post on Wall of friend using Facebook C# SDK, i have made separate FB apps for my localhost and for publishing server, the problem is arising is that it is working fine on my localhost,but when i am running publishing site it is not posting on wall, but showing Posted on Wall successfully( The message i am showing if wall post is successfull) i am providing AppID and AppSecret properly Below is my code of posting on wall of friend.
var fbApplication = new DefaultFacebookApplication { AppId = fbapp, AppSecret = fbsec };
var current = new FacebookWebContext(fbApplication);
Facebook.Web.FacebookWebClient client = new Facebook.Web.FacebookWebClient(fbtoken);
dynamic parameters = new ExpandoObject();
parameters.message = "";
parameters.link = "Link to my Website";
parameters.name = "Name";
parameters.caption = "MyTitle";
parameters.description = "Hello World";
parameters.from = fromId;
object resTest = client.Post("/" + friendId + "/feed", parameters);
答
您好,
我使用的是FacebookClient
而不是FacebookWebClient
,并且运行正常.
我正在Windows应用程序中使用它.
尝试使用类似这样的内容:
Hello,
I am usingFacebookClient
instead ofFacebookWebClient
and working perfectly.
I am using this in a windows application.
Try to use something like this:
var fb = new FacebookClient(_accessToken);
dynamic parameters = new ExpandoObject();
parameters.message = "Message";
fb.Post(me/feed, parameters);
希望您能找到解决方案.
编码愉快.
Hope you get the solution.
Happy coding.