<small id='zkjdW'></small><noframes id='zkjdW'>

  1. <tfoot id='zkjdW'></tfoot>

      <bdo id='zkjdW'></bdo><ul id='zkjdW'></ul>
  2. <i id='zkjdW'><tr id='zkjdW'><dt id='zkjdW'><q id='zkjdW'><span id='zkjdW'><b id='zkjdW'><form id='zkjdW'><ins id='zkjdW'></ins><ul id='zkjdW'></ul><sub id='zkjdW'></sub></form><legend id='zkjdW'></legend><bdo id='zkjdW'><pre id='zkjdW'><center id='zkjdW'></center></pre></bdo></b><th id='zkjdW'></th></span></q></dt></tr></i><div id='zkjdW'><tfoot id='zkjdW'></tfoot><dl id='zkjdW'><fieldset id='zkjdW'></fieldset></dl></div>
    1. <legend id='zkjdW'><style id='zkjdW'><dir id='zkjdW'><q id='zkjdW'></q></dir></style></legend>

      Google Calendar API,只需知道某人的电子邮件地址就

      时间:2023-08-26

          <tbody id='r40fN'></tbody>

        <small id='r40fN'></small><noframes id='r40fN'>

            <bdo id='r40fN'></bdo><ul id='r40fN'></ul>
            <legend id='r40fN'><style id='r40fN'><dir id='r40fN'><q id='r40fN'></q></dir></style></legend>
            <i id='r40fN'><tr id='r40fN'><dt id='r40fN'><q id='r40fN'><span id='r40fN'><b id='r40fN'><form id='r40fN'><ins id='r40fN'></ins><ul id='r40fN'></ul><sub id='r40fN'></sub></form><legend id='r40fN'></legend><bdo id='r40fN'><pre id='r40fN'><center id='r40fN'></center></pre></bdo></b><th id='r40fN'></th></span></q></dt></tr></i><div id='r40fN'><tfoot id='r40fN'></tfoot><dl id='r40fN'><fieldset id='r40fN'></fieldset></dl></div>

                <tfoot id='r40fN'></tfoot>
                本文介绍了Google Calendar API,只需知道某人的电子邮件地址就可以将事件添加到某人的日历中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我已经下载了 Google.Apis 命名空间:

                I have downloaded the Google.Apis namespace:

                using Google.Apis.Auth.OAuth2;
                using Google.Apis.Calendar.v3;
                using Google.Apis.Calendar.v3.Data;
                using Google.Apis.Services;
                

                我花了一整天的时间在网上查看 .NET 示例,了解如何仅通过知道某人的电子邮件地址就可以将事件添加到某人的日历中.

                I've spent the entire day looking on the web to see .NET samples about how I can possible add an event to someones calendar just by knowing their e-mail address.

                我尝试了以下代码,但它出现了错误,而且很明显它不起作用:

                I tried the following code, but it's bringing up errors and it's quite obvious that it isn't going to work:

                Public void Method(string email, string text)
                {
                UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                                new ClientSecrets
                                {
                                    ClientId = "CLIENTID",
                                    ClientSecret = "CLIENTSECRET",
                                },
                                new[] { CalendarService.Scope.Calendar },
                                "user",
                                CancellationToken.None).Result;
                
                   // Create the service.
                   var service = new CalendarService(new BaseClientService.Initializer()
                   {
                                HttpClientInitializer = credential,
                                ApplicationName = "Calendar API Sample",
                   });
                
                
                    Event event1 = new Event()
                    {
                      Summary = "Something",
                      Location = "Somewhere",
                      Start = new EventDateTime() {
                          DateTime = DateTime.Now,
                          TimeZone = "America/Los_Angeles"
                      },
                      End = new EventDateTime() {
                          DateTime = DateTime.Now,
                          TimeZone = "America/Los_Angeles"
                      },
                      Attendees = new List<EventAttendee>()
                          {
                            new EventAttendee() { Email: email } //bringing up an error "Syntax ',' expected
                          }
                    };
                
                    Event thisevent = service.Events.Insert(event1, "primary").Fetch(); // Another error. "Does not contain a definition for Fetch"
                
                }
                

                感谢任何帮助!甚至是其他代码的示例:)

                Any help is appreciated! Even samples of other code :)

                推荐答案

                创建事件并插入事件的部分存在语法错误.下面是一个对 Google API .NET 库有正确语法的片段:

                There are syntax errors in the part where you create the event and insert it. Here is a snippet that has correct syntax for the Google API .NET library:

                Event myEvent = new Event
                {
                  Summary = "Appointment",
                  Location = "Somewhere",
                  Start = new EventDateTime() {
                      DateTime = new DateTime(2014, 6, 2, 10, 0, 0),
                      TimeZone = "America/Los_Angeles"
                  },
                  End = new EventDateTime() {
                      DateTime = new DateTime(2014, 6, 2, 10, 30, 0),
                      TimeZone = "America/Los_Angeles"
                  },
                  Recurrence = new String[] {
                      "RRULE:FREQ=WEEKLY;BYDAY=MO"
                  },
                  Attendees = new List<EventAttendee>()
                      {
                        new EventAttendee() { Email = "johndoe@gmail.com" }
                      }
                };
                
                Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();
                

                这篇关于Google Calendar API,只需知道某人的电子邮件地址就可以将事件添加到某人的日历中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在 asp.net 中收到阿拉伯日期时间错误 下一篇:使用 ASP.NET 日历控件时如何隐藏周末?

                相关文章

                最新文章

              • <i id='vFjWz'><tr id='vFjWz'><dt id='vFjWz'><q id='vFjWz'><span id='vFjWz'><b id='vFjWz'><form id='vFjWz'><ins id='vFjWz'></ins><ul id='vFjWz'></ul><sub id='vFjWz'></sub></form><legend id='vFjWz'></legend><bdo id='vFjWz'><pre id='vFjWz'><center id='vFjWz'></center></pre></bdo></b><th id='vFjWz'></th></span></q></dt></tr></i><div id='vFjWz'><tfoot id='vFjWz'></tfoot><dl id='vFjWz'><fieldset id='vFjWz'></fieldset></dl></div>
                  <bdo id='vFjWz'></bdo><ul id='vFjWz'></ul>

                    <legend id='vFjWz'><style id='vFjWz'><dir id='vFjWz'><q id='vFjWz'></q></dir></style></legend>

                    <small id='vFjWz'></small><noframes id='vFjWz'>

                  1. <tfoot id='vFjWz'></tfoot>