我是新手使用Facebook SDK for C#
我已经在单元测试中看过这篇文章。 Get Access Token programmatically in Unit Test Method
现在,我想在我的墙上删除帖子。
using Facebook;
[TestMethod]
public void Post_to_the_wall()
{
var client = new FacebookClient(token);
dynamic parameters = new ExpandoObject();
parameters.message = "Check out this funny article";
parameters.link = "http://www.example.com/article.html";
parameters.picture = "http://www.example.com/article-thumbnail.jpg";
parameters.name = "Article Title";
parameters.caption = "Caption for the link";
parameters.description = "Longer description of the link";
parameters.actions = new
{
name = "View on Zombo",
link = "http://www.zombo.com",
};
parameters.privacy = new
{
value = "ALL_FRIENDS",
};
dynamic result = client.Post("me/feed", parameters);
// TODO: NOW, delete the post ???
}
有什么建议吗?
答案 0 :(得分:2)
只需这样做:
dynamic result = client.Post("me/feed", parameters);
client.Delete(result.id);
发布方法获取Postid(id属性),您可以用它来删除帖子。
答案 1 :(得分:0)
https://developers.facebook.com/docs/graph-api/reference/v2.2/post
应用可以删除发布的帖子
查看该页面上的示例代码。您需要具有publish_actions的用户令牌才能向DELETE
发出/post-id
请求。