Solved

Office 365 remove messages by date range for several users using powershell

Posted on 2014-11-13
2
2,469 Views
Last Modified: 2014-11-25
Hi,

I have an Office365 account, we have several mailboxes. We would like to delete message for several users by date range. Is there a way with powershell?

Deleting using Outlook or Outlook Web App will take too long.
0
Comment
Question by:NRTCF
2 Comments
 
LVL 9

Accepted Solution

by:
Veerappan Sundaram earned 500 total points
ID: 40441906
Before you do this, please check the legal requirements of your organization on "Email retention"

Do you have access to O365 Online Administration Center? Do you have required permission to run Exchange cmdlets?

If yes, you need to use the Remote Windows Powershell to run Search-Mailbox cmdlet to delete content.

please refer this link: http://technet.microsoft.com/en-us/library/exchange-online-administration-and-management.aspx 

search-mailbox -identity "user_ID" -searchquery {sent:01/01/2010..01/01/2012} -TargetMailbox "different_Mbx_name" -targetfolder "folder_name" -logonly   (Run this to confirm you get the expected result before deleting)

Search-Mailbox -identity "User_ID" -searchquery {sent:01/01/2010..01/01/2012} -Deletecontent

Thanks,
Veera.
0
 
LVL 5

Expert Comment

by:Mai Ali (MVP)
ID: 40450328
you can remove emails for one user by using the Search-Mailbox cmdlet with the DeleteContent parameter to search for and delete messages in one step
For delete message for several users by date range, You can use Search For and Delete Messages from Users' Mailboxes
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Find out what the Office 365 disclaimer function is, why you would use it and its limited ability to create Office 365 signatures.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Microsoft Office Picture Manager has a Picture Shortcuts pane that shows a list with the Recently Browsed folders. While creating my video Micro Tutorial here at Experts Exchange showing How to Install Microsoft Office Picture Manager in Office 2013…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now