我正在尝试在我的应用程序中创建一个事件,但不断收到此“无效参数”错误:
(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();
}