使用Facebook C#SDK共享 [英] Share using Facebook C# SDK

查看:89
本文介绍了使用Facebook C#SDK共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Facebook C#SDK的新手.希望您能给我一些指导.

I am new to the Facebook C# SDK. I hope you are able to give me some guidance.

我希望能够在Facebook上的网站上共享一些内容.

I would like to be able Share some content on my site on Facebook.

这就是我想做的:

在我的网站上,当用户单击在Facebook上共享"时,我想向其Facebook墙发送一些信息-缩略图,标题行和一些内容.

On my site, when the user clicks 'Share on Facebook', I would like to send a few pieces of information -- A thumbnail image, A title row, and some content to their facebook wall.

我已经看到其他网站这样做了.我希望这个SDK可以做到.

I have seen other sites do this seemlessly. I am hoping this SDK can do it to.

我正在使用Facebook 4.2.1 SDK.

I am using Facebook 4.2.1 SDK.

在此先感谢您的帮助. 史蒂夫

Thanks in advance for your help. Steve

推荐答案

您可以在此处找到有关如何执行此操作的示例以及许多其他操作:

You can find an example on how to do that and many other things here: http://facebooksdk.codeplex.com/wikipage?title=Code%20Examples&referringTitle=Documentation

这是代码:

var client = new FacebookClient("my_access_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",
};
parameters.targeting = new {
    countries = "US",
    regions = "6,53",
    locales = "6",
};
dynamic result = client.Post("me/feed", parameters);

注意:这使用的是SDK的版本5.在版本4中,FacebookClient被命名为FacebookApp.

Note: This is using Version 5 of the SDK. FacebookClient was named FacebookApp in Version 4.

这篇关于使用Facebook C#SDK共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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