Add corporate or custom holidays to user calendars – 2nd method – bulk

1+

Most companies, if not all, have their own set of holidays on top of national ones. So, distributing them is a pretty common task for an Office 365 / Exchange admin. There are different approaches out there with their own pros and cons. I’ve come up with two methods that combined give me a great result.

In this post let’s focus on the 2nd method – a bulk one.

I came up with this method after doing the migration from IBM Domino to Office 365. It looks complicated but after doing it several times you’ll get comfortable and it won’t be taking much time anymore.

To see more about the 1st method (manual), please follow this link – Add corporate or custom holidays to user calendars – 1st method – manual


PREREQUISITES:

1) Download and install (please use default settings) Azure Storage Explorer

2) Prepare a .csv file with all accounts using the following template – https://docs.microsoft.com/en-us/office365/securitycompliance/use-network-upload-to-import-pst-files#step-4-create-the-pst-import-mapping-file

In our case that .csv file should look like this:

To get a list of all emails use this PowerShell script:

Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,PrimarySMTPAddress | Export-Csv -Path "C:\Temp\emails.csv"

This PowerShell script will output all email addresses including shared mailboxes and resources. If you don’t want to add corporate holidays to those, either adjust the script or filter the output of the current one.

3) Prepare a .hol file that contains all Contoso Holidays for the year required – this post Add corporate or custom holidays to user calendars – 1st method – manual shows how to do that.


STEPS:

1) Create a new temp user in Office 365 Admin. Any name would work. Assign a license so that this temp user has got a mailbox. If assigning a license is not an option, you can create a shared mailbox instead and work with it.

I would highly recommend using a temp user because we need a .pst file with a fresh calendar that has nothing but Contoso Holidays that need to be distributed. Using your personal calendar might pull some other events that must not be added to other users’ calendars.

2) Configure that new temp user’s profile in the Outlook.

3) Add Contoso Holidays to temp user’s calendar by opening a .hol file. Please see how to prepare such a file in this post – Add corporate or custom holidays to user calendars – 1st method – manual

4) Export temp user’s calendar into calendar.pst file using Outlook built-in functionality.

5) Go to Microsoft 365 admin centerAdmin centers – Security & ComplianceData governanceImport (https://protection.office.com/?rfr=AdminCenter#/import), then:

  • Click on New import job
  • Name your job (e.g. contoso-holidays-2019) – Next
  • Select Upload your data – Next
  • Press on Show network upload SAS URL in the step 2
  • No need to close that dialog window

This link is valid for 1 month. Please save it somewhere as it will be used later.

6) Upload calendar.pst to Azure Cloud Storage using Azure Storage Explorer:

  • Run Azure Storage Explorer
  • Click on Add Account
  • Select Use a shared access signature URI
  • Paste the link without quotes from step 5 into URI field
  • Click on Next, then Connect
  • Go to Local & AttachedStorage Accounts(SAS-Attached Services)Blob Containersingestiondata
  • Click on Upload – select your calendar.pst file – then click on Upload with the rest settings by default

  • Make sure your calendar.pst has been successfully uploaded

7) Go back to Import page in step 5 where we left and check both I’m done uploading my files and I have access to mapping file, then Next.

8) Select a mapping file (Prerequisitesstep 2) and then Validate it.

9) Once validated Save the job. Wait till it’s processed by Microsoft Exchange. Then it will be ready for import.

10) When ready, find and open your job. Click on Import to Office 365.

11) Select No, I want to import everything, then Next.

12) Click on Import data.

13) Wait till the Import is done and check the results. If everything is done properly, the number of imported items must be the same as the number of Contoso Holidays for that year for each mailbox. Notify everyone if needed.

Please note, it takes about 1 day for Microsoft to import data. However, the process is highly paralleled so it shouldn’t be an issue to add those holidays to hundreds or even thousands of mailboxes.

14) Once everything is done, delete the temp user from Office 365 and remove its profile from Outlook.

15)  Run the following PowerShell script to disable Retention Hold:

Get-Mailbox -ResultSize unlimited | Set-Mailbox -RetentionHoldEnabled $false

Important!!! Because this whole method uses the same mechanism that’s used for migrating/importing data, it puts all processed mailboxes into Retention Hold state. That means none of your retention policies will work unless you disable Retention Hold.


Pros:

  • No users’ action is required
  • Can be done at any time during the week
  • Hundreds or thousands of mailboxes can be processed at once

Cons:

  • Takes about 1 day for Microsoft to import data
  • Some preparation work is needed
1+

This Post Has 6 Comments

  1. How’s this work, going forward for new users being added to org?

    0
  2. May I know the last step(15) disabling the retention hold, what does it do?
    It look dangerous

    0
    1. Hi Matthew,
      Disabling Retention Hold is not dangerous, instead forgetting about it and keeping it on is more problematic.
      A simple example. You have a policy that cleans up “Deleted Items” folder after 30 days. You go through that process described in this article, the system turns on Retention Hold for every processed mailbox. If you forget to disable Retention Hold, users’ “Deleted Items” folders will not be cleaned up after 30 days. The system will protect users’ mailboxes from any retention policies / tags.

      0
      1. Dear Pavel,

        But our current policy will delete items from deleted folders after 30 days, how will this command affect any behavior?

        0
        1. Matthew,
          Retention Hold will put all current policies on hold meaning items will not be deleted after 30 days. That’s why it is important to disable Retention Hold from every processed by this method mailbox. Disabling it will put all things back to normal.
          To be honest, that’s how I noticed it – after adding holidays to user calendars, two months later or so a few users reported their Deleted Items were not longer cleaned after 30 days.

          0

Leave a Reply

Close Menu