Tuesday, September 8, 2015

Updating Calendar Overlay using Powershell

Introduction

SharePoint having an option for Calendar overlay. Click here to have introduction. Now, I am going to share a script to update it.

Calendar Settings

Once we applied the Calendar Overlay to the list. The Calendar Settings get append with AggregationCalendar. 


We need to modify this Aggregation Calendar for changes we want in Calendar Overlay. This Calendar Settings is a string. So we can do replace string with old string using script. For example, If we want to change the color. Script will be like this,

$web = Read-Host "Enter Site URL :"
$spweb= Get-SPWeb $web
$calendar = $spweb.Lists["Your List Name"]
$calendar.DefaultView.CalendarSettings = $calendar.DefaultView.CalendarSettings.Replace("Color=""3""","Color=""2""")
$calendar.DefaultView.Update()

That's all Calendar Settings has been updated

2 comments: