C# Google 日历 api service.Events.Insert 全局域无效
C# Google calendar api service.Events.Insert invalid Domain global
当我尝试调用 service.Events.Insert( myEvent, "primary" ) 时出现以下错误:
The service calendar has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
Invalid Value [400]
Errors [
Message[Invalid Value] Location[ - ] Reason[invalid] Domain[global]
]
myEvent 包含这些值:
Event myEvent = new Event
{
Summary = summary,
Description = description,
Location = location,
Id = id,
Start = new EventDateTime( )
{
DateTime = startPoint,
TimeZone = timeZoneName
},
End = new EventDateTime( )
{
DateTime = endPoint,
TimeZone = timeZoneName
}
};
这个错误是什么意思?
Google 中是否有一个地方可以查看抛出特定异常的原因?
我已经搜索了我的文件,但我没有在任何地方指定 GLOBAL。
错误400: Bad Request or user error.这意味着没有提供必填字段或参数,提供的值无效,或者提供的字段组合是无效的。
因此,请确保为方法提供有效值。
这是关于如何正确设置值的 code example。
Event newEvent = new Event()
{
Summary = "Google I/O 2015",
Location = "800 Howard St., San Francisco, CA 94103",
Description = "A chance to hear more about Google's developer products.",
Start = new EventDateTime()
{
DateTime = DateTime.Parse("2015-05-28T09:00:00-07:00"),
TimeZone = "America/Los_Angeles",
},
End = new EventDateTime()
{
DateTime = DateTime.Parse("2015-05-28T17:00:00-07:00"),
TimeZone = "America/Los_Angeles",
},
One more thing make sure your date format should be “yyyy-mm-dd”. It
is based on this
page
此外,如果在日历条目中使用 Recurrence,并指定 'Until' 规则检查它在字符串末尾有一个 "z"。
UNTIL=20180117T235959Z
而不是
UNTIL=20180117T235959
当我尝试调用 service.Events.Insert( myEvent, "primary" ) 时出现以下错误:
The service calendar has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError
Invalid Value [400]
Errors [
Message[Invalid Value] Location[ - ] Reason[invalid] Domain[global]
]
myEvent 包含这些值:
Event myEvent = new Event
{
Summary = summary,
Description = description,
Location = location,
Id = id,
Start = new EventDateTime( )
{
DateTime = startPoint,
TimeZone = timeZoneName
},
End = new EventDateTime( )
{
DateTime = endPoint,
TimeZone = timeZoneName
}
};
这个错误是什么意思?
Google 中是否有一个地方可以查看抛出特定异常的原因?
我已经搜索了我的文件,但我没有在任何地方指定 GLOBAL。
错误400: Bad Request or user error.这意味着没有提供必填字段或参数,提供的值无效,或者提供的字段组合是无效的。 因此,请确保为方法提供有效值。 这是关于如何正确设置值的 code example。
Event newEvent = new Event()
{
Summary = "Google I/O 2015",
Location = "800 Howard St., San Francisco, CA 94103",
Description = "A chance to hear more about Google's developer products.",
Start = new EventDateTime()
{
DateTime = DateTime.Parse("2015-05-28T09:00:00-07:00"),
TimeZone = "America/Los_Angeles",
},
End = new EventDateTime()
{
DateTime = DateTime.Parse("2015-05-28T17:00:00-07:00"),
TimeZone = "America/Los_Angeles",
},
One more thing make sure your date format should be “yyyy-mm-dd”. It is based on this page
此外,如果在日历条目中使用 Recurrence,并指定 'Until' 规则检查它在字符串末尾有一个 "z"。
UNTIL=20180117T235959Z
而不是
UNTIL=20180117T235959