1
votes

I have code that creates an outlook meeting request and it is working great. I want to be able to make this meeting request a Microsoft Teams Meeting. I cannot find any notes online on the objects to use for this and cannot find any objects in Outlook VBA that look like they will work. Does anyone know how to programmatically add Microsoft Teams to a meeting request?

2
You can copy the link to the Team Channel and include it in the email, eg: teams.microsoft.com/l/channel... otherwise it's not clear what you're asking. Can you google: "MS teams api get team channel" .... docs.microsoft.com/en-us/graph/api/…Jeremy Thompson
what do you mean by " add Microsoft Teams to a meeting request"?Subhasish
When you have Microsoft teams installed on a Windows 10 machine and the plugin installed in outlook (which happens when Team is installed), you have an option when creating a meeting to make it a Microsoft Teams meeting. That adds a link in the email to open the meeting in Teams). I want to programmatically add the Teams information. It is just a click of the button in the UI of Outlook.LtlBear

2 Answers

0
votes

The easiest way to run the command on the ribbon programmatically. You just need to know the idMso value of the built-in command. The ExecuteMso method of the CoommandBars class is useful in cases where there is no object model for a particular command. Works on controls that are built-in buttons, toggleButtons, and splitButtons. On failure, it returns E_InvalidArg for an invalid idMso, and E_Fail for controls that are not enabled or not visible.

But we deal with an add-in, so their idMso values are not disclosed. In that case your option is to use Accessibility API, see Microsoft Active Accessibility for more information. Microsoft Active Accessibility is a Component Object Model (COM)-based technology that improves the way accessibility aids work with applications running on Microsoft Windows. It provides dynamic-link libraries that are incorporated into the operating system as well as a COM interface and API elements that provide reliable methods for exposing information about UI elements.

As the last resort, you may consider using Windows API function to click the button programmatically.

P.S. You may find the Are the command codes for ExecuteMso documented? page helpful.

-1
votes

You can use this code

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