Saturday, November 15, 2014

Remove EnterPriseVault Shortcut Class Message after Office 365 Migration

Hi Readers,

One of our Project Client migrated to Office 365 but issue is EnterpriseVault shortcut items were also migrated so now it is required to remove those shortcut messages.

These messages are of Class: IPM.Note.EnterpriseVault.ShortCut

I started searching the internet for some script so that I don't have to rework on what has already been done by the community.

First Method that I came across was using MRM

but we were interested in some scripting so we came across below two scripts that didn't worked for us & we had issues running those (had not enough time to troubleshoot), others also faced the similar issues that can be seen in the comments.

Than I started writing one of my own which is based on outlook.

Finally I found the below one that absolutely worked fine , without a single issue.

Just want to share the research...


Sukhija Vikas


  1. Hi Vikas, I am getting following error when following this solution -- Please help

    Mailbox =
    Performing autodiscover for
    EWS Url found:
    Exception calling "Bind" with "2" argument(s): "Connection did not succeed. Try again later."
    At C:\Temp\Search-MailboxForMessageClass.ps1:157 char:62
    + $folder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind <<<< ($service,$FolderId)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    Processing folder: \
    Exception calling "FindItems" with "3" argument(s): "Connection did not succeed. Try again later."
    At C:\Temp\Search-MailboxForMessageClass.ps1:175 char:32
    + $results = $service.FindItems <<<< ( $FolderId, $searchFilter, $view )
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    You cannot call a method on a null-valued expression.
    At C:\Temp\Search-MailboxForMessageClass.ps1:188 char:44
    + ForEach ($subFolder in $folder.FindFolders <<<< ($view))
    + CategoryInfo : InvalidOperation: (FindFolders:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

  2. I actually got it working by specifying parameter imperrsonate:$true. Thanks Vikas. this looks amazing script and saved our lot of effort.. we are actually migrating users from a trusted forest and they were using enterprise vault and having thousand of EV shourtcut items stored in mailboxes .. Thanks again for such a nice work done!!

  3. Just make sure to run it multiple times till you get We have seen on single run it doesn't remove all if these are thousands in number..

  4. ok noted. We found we have 2 EV message classes needs to be cleared. These messages are of Class: IPM.Note.EnterpriseVault.ShortCut and IPM.Notes.EAS. I believe we need to add additional line to include other message class and we can not add "-OR " operator to include both the message class.

  5. It's possible to get script to delete on one pass, under the Function ProcessItem( $item ) change the $item.Delete to "HardDelete" instead of the original "SoftDelete"