[英]Share dynamic content on facebook using Facebook SDK. How to Include multiple images?
How do I share multiple images on Facebook? 如何在Facebook上共享多张图片? following code snippet shares only one image.
以下代码段仅共享一张图片。 How do I modify this code to cater multiple images?
如何修改此代码以容纳多张图像?
var fb = new FacebookClient();
fb.AccessToken = strToken
fb.AppId = strAppID
fb.AppSecret = strAppSecret
dynamic parameters = new ExpandoObject();
parameters.title = strTitle;
parameters.message = strDescription;
parameters.source = new FacebookMediaObject
{
ContentType = "image/jpeg",
FileName = Path.GetFileName("myimage")
}.SetValue(System.IO.File.ReadAllBytes(@"C:\Pictures\image1.jpg"));
var result = fb.Post("me/photos", parameters);
}
use this code for multiple image upload on facebook, 使用此代码在Facebook上上传多张图片,
FacebookClient fb = new FacebookClient(token.Trim());
//Perform upload
var imageStream = File.OpenRead(photo.Location);
fb.PostCompleted += (o, e) =>
{
imageStream.Dispose();
if (e.Cancelled || e.Error != null)
{
error = e.Error == null ? "canceled" : e.Error.Message;
}
};
dynamic res = fb.PostTaskAsync("/" + fbAlbumID + "/photos", new
{
message = String.Empty,
file = new FacebookMediaStream
{
ContentType = "image/jpg",
FileName = Path.GetFileName(photo.Location)
}.SetValue(imageStream)
});
res.Wait();
var dictionary = (IDictionary<string, object>)res.Result;
but each time one popup notification is generated per each uploaded photo. 但每次为每张上传的照片生成一个弹出通知。 by this question.
通过这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.