目前我正在黑客一个PowerShell脚本,我想有能力发送会议邀请出来,同时增加会议时间(例如,如果第一次邀请发送9:00会议,我想第二次会议将于9:30发出)。展望powershell - 增加会议开始时间的时间?
到目前为止,下面是我的。我可以阅读文本文件的邮件列表,并发送邀请,加入的时间来开会但是林有问题(AddMinutes()似乎并不对会议的工作邀请开始时间)在
$emails = get-content emails.txt
$olAppointmentItem = 1
$o = new-object -comobject outlook.application
foreach ($element in $emails){
$a = $o.CreateItem($olAppointmentItem)
$a.meetingstatus=[Microsoft.Office.Interop.Outlook.olMeetingStatus]::olMeeting
$a.meetingstatus.olMeeting
$a.Start = [datetime]::ParseExact("09:00","hh:mm",$null)
$a.Duration = 30
$a.Subject = "Test Meeting"
$a.Body = "Just a test, please accept, then delete."
$a.Location = "Here"
$a.ReminderMinutesBeforeStart = 15
$a.ReminderSet = $True
$a.recipients.add($element)
$a.ForceUpdateToAllAttendees =$True
$a.send()
$a.Start.AddMinutes(+30)
}
$result = $a.Save()
olMeetingStatus中的O应该大写,因此它将是[Microsoft.Office.Interop.Outlook.OlMeetingStatus]。大多数情况下,在PowerShell中,情况并不重要,但在这种情况下,它确实是因为它指的是C#名称空间。我浪费了一个小时,试图弄清楚为什么会议不会发送。我会尽力编辑答案,但如果不被接受,我想在这里发表评论。 – Skurfur 2016-08-16 16:29:00