I finally use powershell script:
before running these scripts you have to install on your exchange server the Exchange Web Service API.
The first script you have to run it from the orchestrator, in order the password will be available when you run the the second script from the orchestrator.
first script:
$password = "passw0rd"
$password | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File c:\script\vrapass.txt
second script:
Param(
[string]$subject,
[string]$body,
[string]$location,
[string[]]$attendees
)
Import-Module -Name 'C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll'
#$Credential = Get-Credential
$username = 'domain\vraadmin'
$password = Get-content 'c:\script\vrapass.txt' | ConvertTo-SecureString
$Credential = New-Object -TypeName System.management.automation.pscredential -ArgumentList $username, $password
$exchService = New-Object -TypeName Microsoft.Exchange.WebServices.Data.ExchangeService
$exchService.Credentials = New-Object -TypeName Microsoft.Exchange.WebServices.Data.WebCredentials -ArgumentList $Credential.UserName, $Credential.GetNetworkCredential().Password
#$exchService.AutodiscoverUrl($Credential.UserName, {$true})
$exchService.Url = 'https://outlook.co.il/EWS/Exchange.asmx'
#$Start = Get-Date
$time = "18:30"
$date = [System.DateTime]$time
$MeetingRequest = New-Object -TypeName Microsoft.Exchange.WebServices.Data.appointment -ArgumentList $exchService
$MeetingRequest.Subject = $subject
$MeetingRequest.Body = $body
foreach($attendee in $attendees){
$MeetingRequest.RequiredAttendees.Add($attendee) | Out-Null
}
$MeetingRequest.Start = $date
$MeetingRequest.End = $MeetingRequest.Start.AddMinutes(30)
$MeetingRequest.Location = $location
#$MeetingRequest.ReminderDueBy = 30
$MeetingRequest.IsResponseRequested = $false
$MeetingRequest.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToAllAndSaveCopy)
Clarify what you mean.
The same way you can send a mail, I would like to send an outlook meeting to several persons.
vRO itself does not provide Outlook / MSOffice plug-in. However, it should be possible to automate sending an appointment from Outlook using PowerShell, and then call the PowerShell script from a vRO workflow.
As for how to automate Outlook via PowerShell - I guess you'll need to instantiate Outlook.Application object, create an appointment item, fill up its properties, and send it. I haven't done it, but there should be some helpful information (including code snippets) in MSDN and other online resources.
You can add a .ics attachment to an email crafted with vRO. Example:
var fileAttachment = new MimeAttachment();
fileAttachment.name = provisionedVmName + " expiration.ics";
fileAttachment.content = "BEGIN:VCALENDAR\n" +
"VERSION:2.0\n" +
"METHOD:" + method + "\n" +
"BEGIN:VEVENT\n" +
"DTSTART;VALUE=DATE:" + myRequest.dateSubmitted.toISOString() + "\n" +
"DTEND;VALUE=DATE:"+ expDate.toISOString() + "\n" +
"DTSTAMP:" + date.toISOString() + "\n" +
"TRANSP:TRANSPARENT\n" +
"ORGANIZER:vra-a@epic.com\n" +
"SEQUENCE:" + date.toISOString() + "\n" +
"SUMMARY:" + summary + "\n" +
"PRIORITY:5\n" +
"X-MICROSOFT-CDO-IMPORTANCE:1\n" +
"CLASS:PUBLIC\n" +
"END:VEVENT\n" +
"END:VCALENDAR\n";
message.addMimePart(fileAttachment,"text/calendar; charset=UTF-8");
message.sendMessage();
RFC 5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar)
I finally use powershell script:
before running these scripts you have to install on your exchange server the Exchange Web Service API.
The first script you have to run it from the orchestrator, in order the password will be available when you run the the second script from the orchestrator.
first script:
$password = "passw0rd"
$password | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File c:\script\vrapass.txt
second script:
Param(
[string]$subject,
[string]$body,
[string]$location,
[string[]]$attendees
)
Import-Module -Name 'C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll'
#$Credential = Get-Credential
$username = 'domain\vraadmin'
$password = Get-content 'c:\script\vrapass.txt' | ConvertTo-SecureString
$Credential = New-Object -TypeName System.management.automation.pscredential -ArgumentList $username, $password
$exchService = New-Object -TypeName Microsoft.Exchange.WebServices.Data.ExchangeService
$exchService.Credentials = New-Object -TypeName Microsoft.Exchange.WebServices.Data.WebCredentials -ArgumentList $Credential.UserName, $Credential.GetNetworkCredential().Password
#$exchService.AutodiscoverUrl($Credential.UserName, {$true})
$exchService.Url = 'https://outlook.co.il/EWS/Exchange.asmx'
#$Start = Get-Date
$time = "18:30"
$date = [System.DateTime]$time
$MeetingRequest = New-Object -TypeName Microsoft.Exchange.WebServices.Data.appointment -ArgumentList $exchService
$MeetingRequest.Subject = $subject
$MeetingRequest.Body = $body
foreach($attendee in $attendees){
$MeetingRequest.RequiredAttendees.Add($attendee) | Out-Null
}
$MeetingRequest.Start = $date
$MeetingRequest.End = $MeetingRequest.Start.AddMinutes(30)
$MeetingRequest.Location = $location
#$MeetingRequest.ReminderDueBy = 30
$MeetingRequest.IsResponseRequested = $false
$MeetingRequest.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToAllAndSaveCopy)