最简单的方法张贴到Facebook粉丝页面的墙上用C#! [英] Simplest way to post to a facebook fan page's wall with C#!

查看:148
本文介绍了最简单的方法张贴到Facebook粉丝页面的墙上用C#!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个粉丝页面设置为我的公司。

I have a fan page setup for my company.

我要定期更新到该网页的墙壁张贴从我的C#桌面应用程序自动化。

I want to automate the posting of regular updates to that page's wall from my C# desktop application.


  • 其中的Facebook C#库是最简单的?

  • Which Facebook C# library is the simplest?

我怎么能轻易获得访问令牌这个页面?

How can I easily acquire the access token for this page?

什么是最简洁的code片段,只会让我然后张贴在墙上?

What is the most concise code snippet that will simply allow me to then post to the wall?

我已经完成了所有的文档和计算器百万和博客的阅读,这一切似乎很令人费解。当然,它不能是硬..

I have read through all the docs and millions of stackoverflow and blog posts and it all seems very convoluted. Surely it can't be that hard..

我已经安装一个应用程序脸谱内拥有自己的应用ID,API密钥和App秘密等。

I have setup an "application" within facebook that has its own App ID, API Key and App Secret etc.

推荐答案

@Aaron - 最好的图书馆是facebook的C#SDK。我用它每一天......授予我有偏见作为我公司将其写 - 但它是一个动态库,并与来自Facebook(逢星期二)更新的速度是非常适合于可扩展的开发

@Aaron - the best library is the facebook c# sdk. I use it every day... granted I am biased as my company writes it - but it's a dynamic library and with the rate of updates from Facebook (every Tuesday) it is well suited for scalable development.

HTTP://facebooksdk.$c$cplex.com/

我不会进入验证它 - 作为codePLEX的例子还有很多:
<一href=\"http://facebooksdk.$c$cplex.com/wikipage?title=$c$c%20Examples&referringTitle=Documentation\">http://facebooksdk.$c$cplex.com/wikipage?title=$c$c%20Examples&referringTitle=Documentation
但这样做后一个页面,您通过身份验证后,并有一个访问令牌时,code会是这样的:

I won't get into authentication with it - as on codeplex there are many examples: http://facebooksdk.codeplex.com/wikipage?title=Code%20Examples&referringTitle=Documentation But to do a post to a page, after you have authenticated and have an access token, the code would be something like this:

dynamic messagePost = new ExpandoObject();
messagePost.access_token = "[YOUR_ACCESS_TOKEN]";
messagePost.picture = "[A_PICTURE]";
messagePost.link = "[SOME_LINK]";
messagePost.name = "[SOME_NAME]";
messagePost.caption = "{*actor*} " + "[YOUR_MESSAGE]"; //<---{*actor*} is the user (i.e.: Aaron)
messagePost.description = "[SOME_DESCRIPTION]";

FacebookClient app = new FacebookClient("[YOUR_ACCESS_TOKEN]");

try
{
    var result = app.Post("/" + [PAGE_ID] + "/feed", messagePost);
}
catch (FacebookOAuthException ex)
{
     //handle something
}
catch (FacebookApiException ex)
{
     //handle something else
}

希望这有助于。

这篇关于最简单的方法张贴到Facebook粉丝页面的墙上用C#!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆