开发者

Is there anything out there that will make it easy for me to allow my users to share their Facebook photos (and videos) on my site?

I see a bunch of .NET open source projects out there that look to be able to get at the users information, but I just want a user to be able to "post" media that's already on Facebook on my site as well. Other websites seem to allow you to do embedding of their media (I'm really liking oEmbed) but FB seems a bit of a mystery to me. I have no experience using their API, but I'm guessing it has something to do with the "social graph" part. Anyone else done this before? Did you use something or is this easy enough to do without these OS projects? Any examples anywhere of how someone already did this? 开发者_JAVA技巧I wouldn't think that I'm the first person to want to do this but have searched Google and didn't come up with anything.


Have you tried FQL? Using this I was able to get users display pictures on any site I wanted by simply constructing a simple SQL like query.


The Facebook .NET SDK makes this very easy for you. You can download it here: http://facebooksdk.codeplex.com

Here is an example of how you would publish a photo using that SDK:

string photoPath = @"..\..\..\Facebook.Tests\bin\Release\monkey.jpg";
byte[] photo = File.ReadAllBytes(photoPath);

FacebookApp app = new FacebookApp();
dynamic parameters = new ExpandoObject();
parameters.message = "The message you want to go with the photo...";
var mediaObject = new FacebookMediaObject {
    FileName = "monkey.jpg",
    ContentType = "image/jpeg",
};
mediaObject.SetValue(photo);
parameters.source = mediaObject;

dynamic result = app.Api("/the_album_id/photos", parameters, HttpMethod.Post);
string photoId = result.id;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜