Closed chrisTR22 closed 1 year ago
If both the primary mailbox and the archive mailbox are in Exchange Online, items can be copied/moved between them. If the mailboxes are in different environments (e.g. the primary on-premises with a cloud archive), then this script can't move the items (it won't be able to locate the target as the EWS endpoint will be different for that mailbox).
Is it possible to prevent the contacts from being moved to the online archive? All elements are currently being moved and i can't exclude the contacts to move in online archive.
Use -ExcludeFolderList parameter to prevent folders being processed.
I tested -ExcludeFolderList @("\Contacts","\Aufgaben") but the folder Contacts and Aufgaben will continue to be moved
Excluded folder just matches the display name, so don't use a \ (paths are not supported).
-ExcludeFolderList @("\Inbox\2018","\Inbox\2019") is your example, so i thought i have to use a \
Interesting point. :) And I've just double-checked, it does support paths (not sure what I was looking at earlier). If it's not matching, enable -Verbose as you should then see some info about the check.
I tested: .\Merge-MailboxFolder.ps1 -SourceMailbox xy@z.com -TargetArchive -OnlyItemsSentReceivedBefore "01/01/2020" -ExcludeFolderList @("Aufgaben") -ProcessSubfolders -createTargetFolder -Office365 -OAuth -OAuthClientID "1234" -OAuthTenantID "5678" -OAuthSecretKey "91011" -Impersonate -WhatIf But the Folder Aufgaben will continue to be processed. The Log says: Moving from xy@z.com:\Oberste Ebene des Informationsspeichers\Aufgaben to xy@z.com:\Top of Information Store\Aufgaben [MoveItems]Building list of items to move [MoveItems]Search filters applied: 2 In another Folder there is an entry: [IsFolderExcluded]Folder is of type: 1 [IsFolderExcluded]Folder not identified as search folder Checking for exclusions: Aufgaben This entry is missing for the folder Aufgaben. Do you have any idea why? I cant't understand why "Checking for exclusions" is skipped for the folder which has to be excluded.
I think I can see why - your Top of Information store has been localised to Oberste Ebene des Informationsspeichers, so the comparison I use (which allows for top of information store) doesn't work. If you add -Debug parameter, the script will stop at the compare point and show what it is comparing (it will also stop at some other points).
I'll need to update the script to take localisation into account. I haven't seen Top of Information Store localised before.
This should be fixed in 1.2.6 which is now published.
Is it possible to merge mails from the primary mailbox to the exchange online archive of the same user? If i select -TargetArchive, the script doesn't find the target message store. I think this parameter is only for the Outlook Archive folder?