我上传或使用Facebook C#SDK将图片发布到Facebook,但我将此功能称为一次,但它上传了相同的图像三次或更多次。它应该只上传一次Image,但它至少会上传三次,我使用的是5.4.1 SDK。 代码是:
public void AddCover(string accessToken, string imageName, string folder, string loggedinuserId)
{
FacebookClient facebookClient = new FacebookClient(accessToken);
var fbUpl = new Facebook.FacebookMediaObject
{
FileName = imageName,
ContentType = "image/jpg"
};
var bytes = System.IO.File.ReadAllBytes(@"F:\Websites\Covers\" + folder + "\\" + imageName);
fbUpl.SetValue(bytes);
var photoDetails = new Dictionary<string, object>();
photoDetails.Add("message", "Facebook Covers");
photoDetails.Add("image", fbUpl);
var response = facebookClient.Post(@"/" + loggedinuserId + "/photos", photoDetails);
var result = (IDictionary<string, object>)response;
var postedcoverId = result["id"];
}
我在这里遗漏了什么吗?请看代码并告诉我我做错了什么。 感谢