问题
I am new to the Facebook C# SDK. I hope you are able to give me some guidance.
I would like to be able Share some content on my site on Facebook.
Here's what I would like to do:
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.
I have seen other sites do this seemlessly. I am hoping this SDK can do it to.
I am using Facebook 4.2.1 SDK.
Thanks in advance for your help. Steve
回答1:
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
Here is the code:
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);
Note: This is using Version 5 of the SDK. FacebookClient was named FacebookApp in Version 4.
回答2:
Just and update, link to project URL:
https://github.com/facebook-csharp-sdk/facebook-csharp-sdk
来源:https://stackoverflow.com/questions/4952993/share-using-facebook-c-sharp-sdk