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.
Removing Messages by Message Class
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.
MSDN Link Archived
Just want to share the research…
Regards
Sukhija Vikas
Tech Wizard
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: 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
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!!
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..
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.
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”
Hi Vikas. I understand this is an old post. It appears this link is broken . Is there any chance you have this script saved somewhere? It would be a great help.
yes, you can find it here
https://github.com/michelderooij/Remove-MessageClassItems