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

http://www.symantec.com/business/support/index?page=content&id=TECH63556

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.

http://blogs.technet.com/b/manjubn/archive/2012/03/31/exchange-2010-search-and-delete-items-by-messageclass-ews-method.aspx

http://eightwone.com/2013/05/16/removing-messages-by-message-class-from-mailbox/

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

http://msexchange.me/2014/11/15/remove-messages-based-on-message-class-outlook-powershell/

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

http://blogs.msdn.com/b/emeamsgdev/archive/2013/06/25/powershell-search-mailbox-for-items-of-a-particular-message-class-itemclass.aspx

Just want to share the research...

Regards

Sukhija Vikas

http://msexchange.me

5 comments:

  1. Hi Vikas, I am getting following error when following this solution --http://blogs.msdn.com/b/emeamsgdev/archive/2013/06/25/powershell-search-mailbox-for-items-of-a-particular-message-class-itemclass.aspx. Please help

    Mailbox = xxx@domain.com
    Performing autodiscover for xxx@domain.com
    EWS Url found: https://lb.domain.com/ews/exchange.asmx
    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

    ReplyDelete
  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!!

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

    ReplyDelete
  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.

    ReplyDelete
  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"

    ReplyDelete