我正在尝试在我的应用中创建一个事件,但请继续获得此'无效参数'错误:
(OAuthException - #100) (#100) Invalid parameter
登录时:
JsonObject result = facebookClient.Post("/me/events", createEventParameters) as JsonObject;
几次更改了参数,但仍然没有帮助,任何人都可以建议:
public string CreateEvent()
{
var accessToken = accessTok;
FacebookClient facebookClient = new FacebookClient(accessToken);
Dictionary<string, object> createEventParameters = new Dictionary<string, object>();
createEventParameters.Add("owner", "Me");
createEventParameters.Add("name", "Test Event");
createEventParameters.Add("description", "This is a test event.");
createEventParameters.Add("start_time", DateTime.Now.AddDays(2).ToUniversalTime().ToString());
createEventParameters.Add("end_time", DateTime.Now.AddDays(2).AddHours(4).ToUniversalTime().ToString());
createEventParameters.Add("location", "A Street");
// Sample venue
JsonObject venueParameters = new JsonObject();
venueParameters.Add("street", "19 Phipps St");
venueParameters.Add("city", "Toronto");
venueParameters.Add("state", "ON");
venueParameters.Add("zip", "L2A 2V2");
venueParameters.Add("country", "Canada");
venueParameters.Add("latitude", "43.6654507");
venueParameters.Add("longitude", "-79.38569580000001");
createEventParameters.Add("venue", venueParameters);
createEventParameters.Add("privacy", "SECRET");
createEventParameters.Add("updated_time", DateTime.Now.ToString());
//Add the event logo image
FacebookMediaObject logo = new FacebookMediaObject()
{
ContentType = "image/png",
FileName = @"D:/Downloads/bb.png"
};
logo.SetValue(File.ReadAllBytes(logo.FileName));
createEventParameters[@"D:/Downloads/bb.png"] = logo;
JsonObject result = facebookClient.Post("/me/events", createEventParameters) as JsonObject;
return result["id"].ToString();
}
好的,我的日期格式无效。对于FB文档:
注意 - "事件时区"迁移后,所有事件时间均为ISO -8601格式字符串;它们不能再将其指定为时间戳。接受以下格式:
仅日期(例如'2012-07-04'):具有日期但没有特定时间的事件。精确时间(例如,'2012-07-04T19:00:00-0700'):在特定时间点开始的事件,以UTC的特定偏移为单位。这是新的Facebook事件跟踪时间的方式,并允许用户查看不同时区中的事件。