C# 问题是事件只添加了具有客户端id和客户端密钥的单用户方面 标题1
问题是只有一个用户在google日历中添加了带有客户端id和客户端密钥的事件。 但我的要求是,当点击链接重定向到谷歌日历登录页面时,多个用户可以向谷歌日历添加事件。事件详细信息来自数据库。我附上了我以前的代码C# 问题是事件只添加了具有客户端id和客户端密钥的单用户方面 标题1,c#,asp.net-mvc,C#,Asp.net Mvc,问题是只有一个用户在google日历中添加了带有客户端id和客户端密钥的事件。 但我的要求是,当点击链接重定向到谷歌日历登录页面时,多个用户可以向谷歌日历添加事件。事件详细信息来自数据库。我附上了我以前的代码 string eventName = "Dummy"; DateTime startDate = new DateTime(2020, 04, 28, 16, 30, 00); DateTime endDa
string eventName = "Dummy";
DateTime startDate = new DateTime(2020, 04, 28, 16, 30, 00);
DateTime endDate = new DateTime(2020, 04, 28, 17, 00, 00);
string location = null;
startDate = DateTime.SpecifyKind(startDate, DateTimeKind.Local);
endDate = DateTime.SpecifyKind(endDate, DateTimeKind.Local);
string link = "www.sample.in";
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId ="Key",
ClientSecret = "Key",
},
new[] { CalendarService.Scope.Calendar },
"user",
CancellationToken.None).Result;
// Create the service.
var service = new CalendarService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = "Calendar API Sample",
});
var myEvent = new Event
{
Summary = eventName,
Location = location,
Start = new EventDateTime
{
DateTime = startDate,
TimeZone = "Asia/India",
},
End = new EventDateTime
{
DateTime = endDate,
TimeZone = "Asia/India",
},
Recurrence = new String[] { "RRULE:FREQ=WEEKLY;BYDAY=MO" },
//Attendees = new List
//{
//new EventAttendee { Email = "xxxxx@gmail.com"}
//},
};
var recurringEvent = service.Events.Insert(myEvent, "primary");
recurringEvent.SendNotifications = true;
recurringEvent.Execute();