Solved

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

Posted on 2014-11-13
2
2,376 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This Experts Exchange lesson shows how to use VBA to loop through rows in Excel.  In order to sort, filter, and use database features, there needs to be a value in each column for every row. When data arrives with values missing, code to copy values…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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

18 Experts available now in Live!

Get 1:1 Help Now