Google api 批插入时资源Id无效

Google api 批插入时资源Id无效,google-api,google-api-dotnet-client,Google Api,Google Api Dotnet Client,我正在使用.NETAPI批量插入谷歌日历。我有以下代码 var request = new BatchRequest(calendarService); request.Queue<Event>( calendarService.Events.Insert( new Event { Id = String.Format("yot-{0}", item.AppointmentId),

我正在使用.NETAPI批量插入谷歌日历。我有以下代码

var request = new BatchRequest(calendarService);

request.Queue<Event>(
    calendarService.Events.Insert(
    new Event
    {                            
        Id = String.Format("yot-{0}", item.AppointmentId),
        Summary = item.Title,
        Description = item.Description,
        Start = new EventDateTime() { DateTime = item.Date },
        End = new EventDateTime() { DateTime = item.Date.AddHours(item.Length) }
    }, calendar.Id),
    (content, error, i, message) =>
    {
        //Log error
    });

request.ExecuteAsync(); 
var请求=新的批处理请求(calendarService);
请求队列(
calendarService.Events.Insert(
新事件
{                            
Id=String.Format(“yot-{0}”,item.AppointmentId),
摘要=项目名称,
描述=项目。描述,
Start=neweventdatetime(){DateTime=item.Date},
End=neweventdatetime(){DateTime=item.Date.AddHours(item.Length)}
},calendar.Id),
(内容、错误、i、消息)=>
{
//日志错误
});
request.ExecuteAsync();

当我执行并尝试插入时,我得到错误“无效的资源id”。这个错误是什么意思?

您必须遵循此处定义的指导原则:

基本上,id的长度必须在5到1024个字符之间,并且仅由以下字母表中的字符组成:0123456789abcdefghijklmnopqrstuv


尝试使用简单的Guid.NewGuid()或如果不需要随机ID,是否尝试在不使用批处理的情况下运行相同的请求?如果不使用批处理,也无法运行。如果我停止尝试设置Id,它会起作用,但根据这一点,我应该设置Id。您是否遵循这些规则:事件标识符。创建新的单个或重复事件时,可以指定它们的ID。提供的ID必须遵循以下规则:ID中允许的字符是base32hex编码中使用的字符,即小写字母a-v和数字0-9,请参阅RFC2938中的第3.1.2节ID的长度必须在5到1024个字符之间。每个日历的ID必须是唯一的。看一看,请不要混淆。