再会,
在将照片发布到页面时遇到一个奇怪的问题,我可以使用预定的日期和时间发布带有评论的照片而不会出现问题。当我首先走到页面的墙上时,我看到这张照片坐在活动日志中等待发布。时间一到,照片就会出现在页面的墙上,我可以看到并评论照片。如果我找到其他人或通过非 Facebook 用户访问该页面,则图片不存在。我也尝试以另一个页面管理员身份登录,结果相同。
var accessToken = Session["AccessToken"].ToString();
var client = new FacebookClient(accessToken);
dynamic result = client.Get("me", new { fields = "first_name,last_name,email,id" });
string diplaymessage = string.Empty;
diplaymessage = "Message";
dynamic accounts = client.Get("me/accounts", new { limit = "25", offset = "0" });
foreach (dynamic account in accounts.data) {
if (account.category != "Application") {
var pageclient = new FacebookClient(account.access_token);
if (account.id == page.ID) {
dynamic post = null;
//if (product.Targeting != null) {
dynamic parameters = new ExpandoObject();
parameters.source = new FacebookMediaObject {
ContentType = "image/" + product.Extension,
FileName = path + filename
}.SetValue(File.ReadAllBytes(path + filename));
parameters.message = diplaymessage;
if (product.DateScheduled < DateTime.Now) {
parameters.scheduled_publish_time = Facebook.DateTimeConvertor.ToUnixTime(DateTime.Now.AddMinutes(15));
} else {
parameters.scheduled_publish_time = Facebook.DateTimeConvertor.ToUnixTime(product.DateScheduled);
}
parameters.published = false;
try {
post = pageclient.Post("/" + account.id + "/photos", parameters);
} catch (Exception ex) {
//error
}
}
}
}
是否需要传递其他参数才能使其“公开”,即使在通过 facebook 检查照片的权限时它们似乎都是公开的?