异常设置“WebCalUrl”

问题描述 投票:0回答:1

我想在 Outlook 中为 apx 120 用户添加大约 30 个互联网通话。 我做了这个脚本:

$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNameSpace("MAPI")
$profile = $namespace.Folders.Item(1)
$calendars = $profile.Folders | Where-Object { $_.Name -eq "Calendar" }
$internetCalendars = $profile.Folders | Where-Object { $_.Name -eq "Internet Calendars" }
if ($internetCalendars -eq $null) {
    $internetCalendars = $profile.Folders.Add("Internet Calendars")
}
$calendarName = "test calendar"
$calendarLink = "https://outlook.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/calendar.ics"
$internetCalendar = $internetCalendars.Folders.Add($calendarName)
$internetCalendar.WebCalUrl = $calendarLink
$internetCalendar.SendAndReceive'

但是我有这个错误,我该如何修复?谢谢你

At line:20 char:1
+ $internetCalendar.WebCalUrl = $calendarLink
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting```

 
powershell outlook
1个回答
0
投票
Outlook 对象模型中的

MAPIFolder
对象(或任何其他对象)不公开 WebCalUrl 属性。
SendAndReceive
方法由
Namespace
对象实现,而不是 MAPIFolder。

请参阅 https://learn.microsoft.com/en-us/previous-versions/office/developer/office-2003/aa210948(v=office.11)

© www.soinside.com 2019 - 2024. All rights reserved.