i want to add about 30 internet callendars in outlook for apx 120 users .
I made this script:
$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'
But i have this error:
Exception setting “WebCalUrl”: “The property ‘WebCalUrl’ cannot be found on this object. Verify that the property exists and can be set.”
At line:20 char:1
- $internetCalendar.WebCalUrl = $calendarLink
-
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException + FullyQualifiedErrorId : ExceptionWhenSetting
New contributor
Bogdan Moise is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.