Add Birthday or Anniversary Reminders in Office 365 Exchange Online
Introduction
This script creates birthday or anniversary reminders for your contacts. This script also enables you to import a comma-separated values (CSV) file for creating the reminders. Additionally, you can use this script to search a contact folder to find contacts
that have birthdays and anniversaries, and then create the reminders.
Scenarios
Microsoft Outlook has a feature that enables you to “
Add a birthday or anniversary for a contact.” However, this feature
is not available in the Outlook Web App (OWA). Therefore, in order to add birthday or anniversary reminders in OWA, you must find a workaround.
Prerequisites
This script requires Exchange Web Service Managed API 2.0. Please download and install the package from
Microsoft Download Center. This script cannot work correctly without
this package.
Script
This script contains the following advanced functions:
- Connect-OSCEXOWebService
- Search-OSCEXOContact
- New-OSCEXOContactReminder
You can use this script in the following way.
1. Open Windows PowerShell.
2. Run Import-Module cmdlet to import this module file.
Import-Module filepath\scriptname.psm1
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
powershell
#Begin to search contacts
$itemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView($PageSize)
$itemView.PropertySet = $propertySet
do
{
if ($searchFilterCollection.Count -ne 0) {
$findResults = $currentContactsFolder.FindItems($searchFilterCollection,$itemView)
} else {
$findResults = $currentContactsFolder.FindItems($itemView)
}
foreach ($findResult in $findResults) {
$PSCmdlet.WriteObject($findResult)
}
$itemView.Offset += $PageSize
} while ($findResults.MoreAvailable)
#Begin to search contacts$itemView = New-Object Microsoft.Exchange.WebServices.Data.ItemView($PageSize)
$itemView.PropertySet = $propertySetdo
{
if ($searchFilterCollection.Count -ne 0) {
$findResults = $currentContactsFolder.FindItems($searchFilterCollection,$itemView)
} else {
$findResults = $currentContactsFolder.FindItems($itemView)
}
foreach ($findResultin$findResults) {
$PSCmdlet.WriteObject($findResult)
}
$itemView.Offset += $PageSize
} while ($findResults.MoreAvailable)
Examples
Example 1: How to display help about
New-OSCEXOContactReminder
To display help about this function, run this command.
Get-Help New-OSCEXOContactReminder -Full
Example
2: How to start a connection
to Office 365 Exchange Online.
To initiate a connection to Office 365
Exchange Online, please run this command. You must run this example before any other step.
Connect-OSCEXOWebService
-Credential (Get-Credential admin@domain01.onmicrosoft.com)
Note The Connect-OSCEXOWebService function
creates a new variable called exService. This variable is in the global scope of the current Windows PowerShell session. This variable is used by other functions in the script.
Example
3: How to initiate a connection
to Office 365 Exchange Online by using a different credential.
To initiate a connection to Office 365
Exchange Online by using a different credential, please run this command.
Connect-OSCEXOWebService
-Credential (Get-Credential admin@domain02.onmicrosoft.com) -Force
Note To replace
the credential in the current exService variable, you must use the Force parameter. Otherwise, Connect-OSCEXOWebService indicates
the user name of the current credential.
Example
4: How to initiate a connection
to Office 365 Exchange Online by using a different time zone.
To initiate a connection to Office 365
Exchange Online by using a different time zone, please run this command.
Connect-OSCEXOWebService
-Credential (Get-Credential admin@domain01.onmicrosoft.com) -TimeZoneStandardName "Pacific Standard Time"

Example
5: How to return all the contacts
to the default contact folder.
To return all the contacts to the default
contact folder, please run this command.
Search-OSCEXOContact
Example
6: How to return contacts
that have birthdays to a specific contact folder.
To return contacts that have birthdays
to a specific contact folder, please run this command.
Search-OSCEXOContact
-ContactFolder "\Fabrikam\" -HasBirthday
Note By
default, the outputs of Search-OSCEXOContact are
optimized for the best performance. If you want to load FirstClassProperties, please use the BasePropertySet parameter. The default value of BasePropertySet is IdOnly.
Example
7: How to show what would
happen if the New-OSCEXOContactReminder runs.
To show what would happen if the New-OSCEXOContactReminder runs
please run this command.
New-OSCEXOContactReminder
-CsvFile C:\Scripts\052\Contacts.csv -Whatif
Note By
default, New-OSCEXOContactReminder verifies
the duplication by checking the subject of the appointments that are created. If you have mulitple contacts who have same name, please distinguish them by changing their names.
Example
8: How to create reminders
for contacts that have birthdays or anniversaries in the default Calendar folder.
To create reminders for contacts that
have birthdays or anniversaries in the default Calendar folder and that are imported from a comma-separated values (CSV) file, please run this command.
New-OSCEXOContactReminder
-CsvFile C:\Scripts\052\Contacts.csv
Example
9: How to create reminders
for contacts that have birthdays or anniversaries in a specific calendar folder.
To create reminders for contacts that
are returned by Search-OSCEXOContact and
that have
birthdays or anniversaries in a specific calendar, please run this command.
Search-OSCEXOContact
| New-OSCEXOContactReminder -CalendarFolder "\Contacts' Birthday\" -Verbose