【问题标题】:I am trying to make an event in google calendar using MS access vba我正在尝试使用 MS access vba 在谷歌日历中进行活动
【发布时间】:2015-12-12 21:14:30
【问题描述】:

计划制作一个 C# dll 文件,然后通过制作 COM 将该 dll 文件添加到 MS 访问 VBA 代码中 在 C# 代码中一切正常,除了当我在 C# 中使用调试器时它显示“GoogleWebAuthorizationBrokes.cs not found”并且我必须使用继续按钮来执行进一步的代码,否则代码运行正常并在谷歌中创建一个事件日历 但是当我使用从 VBA 调用方法时,它会转到 C# 但不执行整个方法

public string CalendarMethod(string Email, string text)
        {
            try
            {

    Msg = "Credential started";
                    UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                        new ClientSecrets
                        {
                            ClientId = "ClientID",
                            ClientSecret = "ClientSecret",
                        },
                        new[] { CalendarService.Scope.Calendar },
                        "user",
                        CancellationToken.None).Result;
                    Msg = "Credential Executed";
                    // Create the service.
                    var service = new CalendarService(new BaseClientService.Initializer()
                    {
                        HttpClientInitializer = credential,
                        ApplicationName = "Calendar API Sample",
                    });
                    Msg = "Service Executed";
                    Event myEvent = new Event()
                    {
                        Summary = "Test Event",
                        Location = "City",
                        Start = new EventDateTime()
                        {
                            DateTime = DateTime.Now,
                            TimeZone = "America/Los_Angeles"
                        },
                        End = new EventDateTime()
                        {
                            DateTime = DateTime.Now,
                            TimeZone = "America/Los_Angeles"
                        },
                        Recurrence = new String[] {
                      "RRULE:FREQ=WEEKLY;BYDAY=MO"
                  },
                        Attendees = new List<EventAttendee>()
                        {
                            new EventAttendee() { Email = "ishooagarwal@gmail.com" } 
                        }
                    };

                    Event recurringEvent = service.Events.Insert(myEvent, "primary").Execute();
                    Msg = "Event Executed";
                    return "Executed" + Msg;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex + Msg);
                    return "Not executed" + Msg +ex;
                }
            }

它总是从 Credential Started 返回 它在 VBA 端返回一个巨大的消息 System.AggregateException 发生一个或多个错误 -------> System.IO.FileNotFoundException 无法加载文件或程序集“System.Net.Http.Primitives,版本=1.5.0.0,文化=中性,publicKeyToken=b03。 ......”或其依赖项之一,系统找不到指定的文件 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess{任务任务} 在 Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess {任务任务} 在 Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker。

【问题讨论】:

    标签: c# asp.net vba visual-studio-2013


    【解决方案1】:

    看起来当您调用 GoogleWebAuthorizationBroker.AuthorizeAsync 方法时,它正在寻找不在执行机器上的 System.Net.Http.Primitives 依赖项。

    确保此引用与您的应用程序一起部署。

    这看起来像是一个重复的问题。

    Could not load file or assembly System.Net.Http.Primitives. Located assembly's manifest definition does not match the assembly reference

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 1970-01-01
      • 2011-12-04
      • 1970-01-01
      • 1970-01-01
      • 2011-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多