我想创建一个活动,但我不知道如何更改活动图片。我知道这是一个非常古老的问题,但我仍然找不到任何解决方案,我很快就会放弃......请至少告诉我这是来自 Facebook 的错误还是其他什么?
这是我的代码:
Facebook.FacebookClient fb = new Facebook.FacebookClient(accessToken);
Dictionary<string, object> ev = new Dictionary<string, object>();
ev.Add("name", model.name);
ev.Add("start_time", model.start_time);
ev.Add("end_time", model.end_time);
ev.Add("description", model.description);
ev.Add("location", model.location);
ev.Add("privacy_type", model.privacy_type);
ev.Add("is_date_only", model.is_date_only);
//ev.Add("picture", "@https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg"); //NOT WORKING
//ev.Add("source", "@https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg"); //NOT WORKING
//ev.Add("picture", HttpUtility.UrlEncode("@https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg")); //NOT WORKING
//ev.Add("source", HttpUtility.UrlEncode("https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg")); //NOT WORKING
//ev.Add("picture", model.picture); //NOT WORKING
object EventId = fb.Post("/me/events", ev);
Dictionary<string, string> p = (new JavaScriptSerializer()).Deserialize<Dictionary<string, string>>(EventId.ToString());
Dictionary<string, object> pic = new Dictionary<string, object>();
//pic.Add("source", model.picture); //NOT WORKING
//pic.Add("picture", HttpUtility.UrlEncode("https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg")); //NOT WORKING
//pic.Add("source",HttpUtility.UrlEncode("https://fbcdn-photos-g-a.akamaihd.net/hphotos-ak-ash3/c0.0.50.50/p50x50/601514_10151470263757778_629077232_s.jpg")); //NOT WORKING
object objPicture = fb.Post("/" + p["id"] + "/picture", pic);
访问令牌、图片 URI 和创建新事件工作正常,但图片不行。