Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 问题是事件只添加了具有客户端id和客户端密钥的单用户方面 标题1_C#_Asp.net Mvc - Fatal编程技术网

C# 问题是事件只添加了具有客户端id和客户端密钥的单用户方面 标题1

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

问题是只有一个用户在google日历中添加了带有客户端id和客户端密钥的事件。 但我的要求是,当点击链接重定向到谷歌日历登录页面时,多个用户可以向谷歌日历添加事件。事件详细信息来自数据库。我附上了我以前的代码

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();