有没有更好的方法在bot应用程序中启动outlook add-appointment窗口?

问题描述 投票:0回答:2

我需要在bot应用程序中启动outlook日历约会。我在Microsoft文档中找到了以下代码,用于启动outlook电子邮件。

var message = context.MakeMessage() as IMessageActivity;
message.ChannelData = JObject.FromObject(new
{
  action = new { type = "LaunchUri", uri = "mailto:[email protected]=This%20is%20the%20subject&body=This%20is%20t e%20body"
   } 
 });
   await context.PostAsync(message);

此外,我尝试了Microsoft.Office.Interop.Outlook添加约会,它也不适合我。

            Outlook.Application outlookApp = new Outlook.Application(); // creates new outlook app
            Outlook.AppointmentItem oAppointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Outlook.OlItemType.olAppointmentItem); // creates a new appointment
            oAppointment.Subject = apt.Subject;
            oAppointment.Body = apt.Body;
            oAppointment.Location = apt.Location;
            oAppointment.Start = Convert.ToDateTime(apt.StartTime);
            oAppointment.End = Convert.ToDateTime(apt.EndTime);

是否有更好的方式来启动Outlook日历约会。

outlook botframework cortana
2个回答
0
投票

您的代码必须调用oAppointment.Save

你究竟想做什么?默默地创建一个约会(然后你上面的代码需要调用oAppointment.Save)或显示给用户(然后调用oAppointment.Display)?

如果您的代码在服务器上运行,请创建一个iCal文件并让用户下载并在(本地)Outlook中打开 - 它将很乐意显示约会。


0
投票

史蒂夫提到你可以使用Microsoft Graph。

您可以将ics文件作为媒体附件发送(我还没试过)。

或者您可以调查协议处理程序outlookcal是否支持深层链接。

我认为这个链接告诉你它在团队https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deep-links中是如何运作的

© www.soinside.com 2019 - 2024. All rights reserved.