将Microsoft团队添加到Outlook会议请求

时间:2020-07-16 20:49:04

标签: vba outlook microsoft-teams

我有一些代码可以创建一个Outlook会议请求,并且效果很好。我希望能够使此会议请求一次Microsoft Teams会议。我无法在线找到用于此目的的对象上的任何注释,也无法在Outlook VBA中找到任何看起来像它们可以工作的对象。有谁知道如何以编程方式将Microsoft Teams添加到会议请求中?

2 个答案:

答案 0 :(得分:0)

以编程方式在功能区上运行命令的最简单方法。您只需要知道内置命令的idMso值即可。在没有特定命令的对象模型的情况下,CoommandBars类的ExecuteMso方法很有用。适用于内置buttonstoggleButtonssplitButtons的控件。失败时,它将为无效的E_InvalidArg返回idMso,为未启用或不可见的控件返回E_Fail

但是我们处理加载项,因此不公开其idMso值。在这种情况下,您的选择是使用Accessibility API,有关更多信息,请参见Microsoft Active Accessibility。 Microsoft Active Accessibility是一种基于组件对象模型(COM)的技术,它改进了辅助功能与在Microsoft Windows上运行的应用程序配合使用的方式。它提供了集成到操作系统中的动态链接库,以及COM接口和API元素,它们提供了用于公开有关UI元素的信息的可靠方法。

作为最后的选择,您可以考虑使用Windows API函数以编程方式单击按钮。

P.S。您可能会发现Are the command codes for ExecuteMso documented?页有帮助。

答案 1 :(得分:-1)

您可以使用此代码

Sub teammetting()
Dim nm As Outlook.AppointmentItem
Set nm = Application.CreateItem(olAppointmentItem)
nm.MeetingStatus = olMeeting
nm.Subject = "Subject"
nm.Start = 'format:DD/MM/YYYY HH:MM:SS AM/PM
nm.End =""'format:DD/MM/YYYY HH:MM:SS AM/PM
nm.requiredattendees "mail address of the invitees"
nm.Body = "Set the body of the email"
'Show the meeting
nm.Display
SendKeys "{F10}", True
'Switch to ribbon shortcuts
SendKeys "H", True
'Hit the Microsoft teams meetings button, requires teams to be installed
SendKeys "TM", True
'Now to add signature: Switch to meeting location button
end sub
'use this code and try as there isn't any note of objects or