0

Im trying fo fix some bithday issues from my contact when migrating from local exchange to office365.

So i want to change the MAPI attribute PID_TAGBIRTHDAY to have +2 hours.

Im trying to use powershell with a local MAPI session but it doesent save my changes to the Outlook / server side.

  $olApp = new-object -comobject outlook.application
$namespace = $olApp.GetNamespace("MAPI")
$Contacts = $namespace.GetDefaultFolder(10)

foreach ($Entry in $Contacts.Items)
{
    #write-host $Entry.FirstName
    #write-host $Entry.Birthday
    #write-host $Entry.Birthday.ToUniversalTime()

    if ($Entry.Birthday.ToUniversalTime().hour -eq 23)
    {
        $newname= $Entry
        $newTime = $Entry.Birthday.AddHours(2)
        $Entry.Birthday = $newTime
        $Entry.Save()

    }

}

$olApp.Quit | Out-Null
[GC]::Collect()
  • Have you confirmed the code within your IF block is executing? – Appleoddity Sep 26 '19 at 12:17
0

You mean you didn't receive any error but the command didn't take effect? How long did you wait for the command to take effect?

What about editing it manually in Outlook? Does it take effect? Or ou can refer to this How to update contact information in Exchange Online in Office 365

  • I have like 1000 contact where i need to check the date of birth and change it. I wont do this by hand. Command doesent throw any error but it dosent save the +2 hours as well. – Ivan Viktorovic Sep 27 '19 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.