Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Add Resource Calendar Room List

Hi all!

 

I have been on the lookout for a PowerShell script or something that can help in adding resources (meeting rooms from Exchange) to clients Outlook.

 

The idea is that via PowerShell or whatever works run the file on their clients so in Outlook it adds resource rooms into running Outlooks calendar on users clients.

 

I have had some luck in finding this code below: BUT it does not add all the rooms stated as strName (it just adds 3). Overall I am not happy about the idea of hijacking the Outlook process. I know that we love full contact IT but this time it is not what I am going for.

Can this be remade to a PowerShell?

-------------------------------------------------------------------------------------------------------------------------------

Dim objApp
Dim objNS
Dim objFolder
Dim strName(5) 'Array size
Dim objDummy
Dim objRecip
Dim calendar

'Names for resource accounts (alias)

strName(0) = "1"
strName(1) = "2"
strName(2) = "K"
strName(3) = "L"
strName(4) = "S"
strName(5) = "T"

Const olMailItem = 0
Const olFolderCalendar = 9

'This section will start outlook.exe - wait 9 seconds - Changes the Focus to Outlook - Wait another second
'then add calendars
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "outlook"
WScript.Sleep 9000
WshShell.AppActivate "Outlook"
WScript.Sleep 1000

'For Each Next Loop while adds each calendar from strName(array) to the users Shared Calendars

For Each calendar In strName

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = Nothing

Set objDummy = objApp.CreateItem(olMailItem)
Set objRecip = objDummy.Recipients.Add(calendar)
objRecip.Resolve
If objRecip.Resolved = True Then
On Error Resume Next
Set objFolder = objNS.GetSharedDefaultFolder(objRecip, olFolderCalendar)
On Error GoTo 0
Else
MsgBox "Could not find ", , _
"User not found"
End If

Next

Set GetOtherUserCalendar = objFolder
Set objApp = Nothing
Set objNS = Nothing
Set objFolder = Nothing

1

Comments

1 comment
Date Votes
  • Hi,

     

    I eventually solved it by forcing the start by add-in Microsoft Exchange Add-in via GPO for Outlook.

    That way the clients/outlook get the button "room searcher" when doing New Meeting. And from that view one can choose the meeting rooms that are resources in Exchange.

     

    0