使用.NET-c在Google日历上添加事件#
我正在尝试使用google calendar API添加一个事件,这是我正在使用的代码:使用.NET-c在Google日历上添加事件#,.net,.net,我正在尝试使用google calendar API添加一个事件,这是我正在使用的代码: public void InsertEntry() { EventEntry entry = new EventEntry(); entry.Title.Text = "Test"; entry.Content.Content = "Content Test"; Where location = new Where(); location.ValueString
public void InsertEntry()
{
EventEntry entry = new EventEntry();
entry.Title.Text = "Test";
entry.Content.Content = "Content Test";
Where location = new Where();
location.ValueString = "Location";
entry.Locations.Add(location);
When time = new When(DateTime.Now, DateTime.Now.AddDays(2));
entry.Times.Add(time);
Uri calendarUri = new Uri("https://www.google.com/calendar/feeds/CALENDER_ID/public/basic");
AtomEntry insertedEntry = service.Insert(calendarUri,entry);
}
我得到了这个错误:
“其他信息:执行身份验证请求返回意外结果:404”
有人知道如何解决这个问题吗?我见过,所以我应该使用p12键?@CodeCaster。您知道如何使用以下内容:ServiceAccountCredential credential=new ServiceAccountCredential(new ServiceAccountCredential.Initializer(serviceAccountEmail)//使用CertiGate创建凭据{Scopes=new[]{”“}//此scopr用于电子表格,请查看google scope常见问题解答了解其他问题。}来自Certificate(证书));但对于日历,而不是电子表格?上面写着“这个范围是用于电子表格的,其他人请查看google scope FAQ”…这是FAQ:这是日历的范围:
http(s):///www.google.com/calendar/feeds/
。最终我用:,解决了这个问题,我使用p12密钥进行了身份验证。