C# 我正在尝试使用MS access vba在google日历中创建一个事件

C# 我正在尝试使用MS access vba在google日历中创建一个事件,c#,asp.net,vba,visual-studio-2013,C#,Asp.net,Vba,Visual Studio 2013,计划生成一个C#dll文件,然后通过生成COM将该dll文件添加到MS access VBA代码中 在C#代码中一切正常,除了在C#中使用调试器时显示“GoogleWebAuthorizationBrokes.cs not found”,我必须使用“继续”按钮执行进一步的代码,否则代码运行正常,并在google日历中创建事件 但是当我使用从VBA调用方法时,它会转到C#,但不会执行整个方法 public string CalendarMethod(string Email, string tex

计划生成一个C#dll文件,然后通过生成COM将该dll文件添加到MS access VBA代码中 在C#代码中一切正常,除了在C#中使用调试器时显示“GoogleWebAuthorizationBrokes.cs not found”,我必须使用“继续”按钮执行进一步的代码,否则代码运行正常,并在google日历中创建事件 但是当我使用从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;
                }
            }
公共字符串日历方法(字符串电子邮件、字符串文本)
{
尝试
{
Msg=“凭证已启动”;
UserCredential credential=GoogleWebAuthorizationBroker.AuthorizationAsync(
新客户的秘密
{
ClientId=“ClientId”,
ClientSecret=“ClientSecret”,
},
新[]{CalendarService.Scope.Calendar},
“用户”,
取消令牌。无)。结果;
Msg=“凭证已执行”;
//创建服务。
var service=new CalendarService(new BaseClientService.Initializer()
{
HttpClientInitializer=凭证,
ApplicationName=“日历API示例”,
});
Msg=“已执行服务”;
Event myEvent=新事件()
{
Summary=“测试事件”,
Location=“城市”,
开始=新的EventDateTime()
{
DateTime=DateTime。现在,
时区=“美国/洛杉矶”
},
End=neweventdatetime()
{
DateTime=DateTime。现在,
时区=“美国/洛杉矶”
},
递归=新字符串[]{
“RRULE:FREQ=每周;BYDAY=MO”
},
与会者=新名单()
{
新建EventAttendee(){Email=“ishooagarwal@gmail.com" } 
}
};
Event recurringEvent=service.Events.Insert(myEvent,“primary”).Execute();
Msg=“事件已执行”;
返回“已执行”+消息;
}
捕获(例外情况除外)
{
控制台写入线(ex+Msg);
返回“未执行”+Msg+ex;
}
}
它总是从凭证开始返回 它在VBA端返回一个巨大的消息 System.AggregateException发生一个或多个错误------->System.IO.FileNotFoundException无法加载filem或程序集“System.Net.Http.Primitives,Version=1.5.0.0,culture=neutral,publicKeyToken=b03……”或其依赖项之一,系统找不到指定的文件 在Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess{Task Task} 在Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess{Task Task}
在Google.api.Auth.OAuth2.GoogleWebAuthorizationBroker上。看起来,当您调用GoogleWebAuthorizationBroker.AuthorizationAsync方法时,它正在查找System.Net.Http.Primitives的依赖项,而该依赖项不在执行机器上

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

这看起来像是重复的问题