SP online : Creating Recurring Calendar Events with PowerShell

Bob MD 61 Reputation points
2021-10-25T01:49:49.923+00:00

Hi
Is there a way to create Recurring Calendar Events with PowerShell?

I can get the item with this code below, but not sure how to do recur events every 9 weeks on Monday.
$listItems = Get-PnPListItem -List $ListName -Query "<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Bob</Value></Eq></Where></Query></View>"

Thank you.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JoyZ 18,111 Reputation points
    2021-10-25T06:24:37.18+00:00

    @Bob MD ,

    We can use PnP Powershell in SharePoint online to create recurring calendar events every 9 week(s) on Monday:

    #Variables  
    $SiteURL = "https://tenant.sharepoint.com/sites/Team1"  
    $CalendarName = "Cal614"  
       
    #Connect to PnP Online  
    Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
       
    #Add Event to Calendar  
    Add-PnPListItem -List $CalendarName -Values @{"Title" = "TestMichael4"; "Description"= "Test"; "Location"= "Ballroom"; "EventDate" = [datetime]"10/28/2021 8AM"; "EndDate"=[datetime]"10/28/2022 9AM"; "fRecurrence" = "1"; "fAllDayEvent" = "0"; "UID"=[guid]::NewGuid(); "EventType"=1;"RecurrenceData" = "<recurrence><rule><firstDayOfWeek>su</firstDayOfWeek><repeat><weekly mo='TRUE' weekFrequency='9'/></repeat><repeatForever>FALSE</repeatForever></rule></recurrence>" }  
    

    Result for your reference:

    144506-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.