问题描述
请提供一个示例,说明如何使用在此位置找到的C#Facebook SDK发布到群组墙上 https://github.com/facebook-csharp-sdk/facebook-csharp-sdk .以下是几行相关代码.创建fb客户端,填写参数(未显示),并进行fb.post调用.为了尝试张贴到群组墙上,我所做的就是将我/提要"更改为"groupId/提要".我可能会找出问题所在,但Facebook错误没有提供任何信息.返回的错误是(OAuthException)发生意外错误.请稍后重试您的请求."
Please give a sample of how to post to a group wall using the C# Facebook SDK found at this location https://github.com/facebook-csharp-sdk/facebook-csharp-sdk . Below is just a few lines of relevant code. An fb client is created, parameters filled in (not shown), and a fb.post call is made. For my attempt to post to a group wall, all I did was change the "me/feed" to "groupId/feed". I could probably figure out what is wrong but the Facebook error provides no information. The error returned is "(OAuthException) An unexpected error has occurred. Please retry your request later."
var fb =新的FacebookWebClient();
var fb = new FacebookWebClient();
原始SDK示例代码为:dynamic id = fb.Post("me/feed",parameters);
Original SDK Sample Code is: dynamic id = fb.Post("me/feed", parameters);
试图发布到群组的信息是:动态id = fb.Post("328271290556233/feed",参数);
Attempt to Post to Group is: dynamic id = fb.Post("328271290556233/feed", parameters);
不幸的是,我并没有使用上面提到的SDK来找到示例.
Unfortunately I have not been unable to find an example using the SDK referenced above.
谢谢您的帮助.
推荐答案
尝试了多次尝试后,我通过尝试使用 http://developers.facebook.com/tools/explorer .它确实发布了,我意识到我已经授予了该应用程序所有权利.然后,我删除了所有权利,并一一添加回去.有趣的是,如果您缺少publish_stream
权限,则尝试发布会导致有用的错误消息,指出应用程序无权发布.如果您的应用程序具有publish_stream
,但没有user_groups
,则您将收到未知错误.因此,要解决我的问题,我要做的就是让我的应用程序请求user_groups
权限.我使用的确切权限是user_about_me,user_groups,publish_stream,manage_pages
.我讨厌我错过了这么明显的东西,但是有用的错误消息会很不错.要使用SDK发布到群组,只需将"me"替换为群组ID.就是这样.
After trying multiple attempts, I figured out the problem by trying to post a message to my group using the Facebook Explorer app at http://developers.facebook.com/tools/explorer . It did post and I realized I had granted the application all rights. I then removed all rights and added back one by one. Here is what is interesting, if you are missing the publish_stream
right, then a post attempt results in a useful error message stating the application does not have the right to post. If your application has publish_stream
but not user_groups
, then you get the unknown error. So, to fix my problem all I had to do was have my application ask for the user_groups
right. The exact rights I use are user_about_me,user_groups,publish_stream,manage_pages
. I hate I missed something so obvious but a helpful error message would have been nice. To post to a group using the SDK just replace "me" with the group id. That is it.
这篇关于Facebook C#SDK示例将发布到群组墙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!