Retrieving Email Data from Mailbox for the Past 6 Years

Mohana Reddy 80 Reputation points
2025-01-19T06:19:26.46+00:00

Is it possible to retrieve all emails sent from a mailbox over the past 6 years in CSV or Excel format from the admin center? Are there any PowerShell commands available to check and extract this data?

Microsoft Exchange Online
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,410 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,763 questions
Microsoft Exchange
Microsoft Exchange
Microsoft messaging and collaboration software.
636 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Amit Singh 5,071 Reputation points
    2025-01-19T13:22:11.6733333+00:00

    You can use PowerShell to get all emails sent from a mailbox over the past 6 years in CSV or Excel format. It require some admin-level access.

    Search-Mailbox -Identity "UserMailbox" -SearchQuery "sent:01/01/2018..01/01/2024" -TargetMailbox "AdminMailbox" -TargetFolder "SentItemsSearch" -LogLevel Full
    

     After running the above command, you can then export the results from SentItemsSearch folder into a CSV file using another command or manually download them.

    Through EAC Message trace is limited to 90 days. For older data (up to 90 days), you might need to run multiple traces or use the Security & Compliance Center.

    Let me know if you have any query.

    0 comments No comments

  2. AinhoaGiles 155 Reputation points
    2025-01-20T07:17:03.06+00:00

    Yes, it is possible to retrieve emails sent from a mailbox over the past 6 years in CSV or Excel format using Microsoft 365 Admin Center or PowerShell. However, retrieving such a large volume of data requires eDiscovery tools and appropriate permissions. Here’s how to do it:


    Using Microsoft 365 Admin Center

    Set Up eDiscovery Permissions:

    • Go to Microsoft Purview Compliance Center > Permissions.
      • Assign yourself the eDiscovery Manager role to access eDiscovery tools.
      Create an eDiscovery Case:
      - Navigate to **Microsoft Purview Compliance Center** > **Content Search**.
      
         - Create a new content search and name it appropriately.
      
         **Define Search Conditions**:
      
            - Set the **Locations** to include the mailbox in question.
      
               - Use a query like `sent>=01/01/2018 AND sent<=01/01/2024` to define the date range.
      
                  - Run the search and review the results.
      
                  **Export Results**:
      
                     - Once the search completes, export the results.
      
                        - Use the provided link to download the data in PST format.
      
                        **Convert to CSV/Excel**:
      
                           - Use tools like Outlook or specialized software to convert PST files into CSV or Excel.
      

    Using PowerShell

    Connect to Exchange Online: Run the following commands to connect:

    Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com
    

    Export Sent Items: Use the Search-Mailbox or New-ComplianceSearch cmdlets to export data. Example using Search-Mailbox:

    Search-Mailbox -Identity "user@yourdomain.com" -SearchQuery "SentItems AND after:01/01/2018 AND before:01/01/2024" -TargetMailbox "admin@yourdomain.com" -TargetFolder "SentItemsExport" -LogOnly -LogLevel Full
    
    • The above command logs all sent items within the specified date range into a folder in the target mailbox. Convert to CSV: Export results from the mailbox to a CSV using PowerShell:
         Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | Export-Csv -Path "C:\SentEmails.csv" -NoTypeInformation
      

    Verify Email Data

    Before processing, verify the extracted email data:

    • Use an email verifier tool to validate addresses in the extracted list to ensure deliverability and correctness.
    • Example tools include email verification APIs or scripts to identify invalid or outdated addresses.

    This process ensures you retrieve the emails and have valid and accurate data for analysis or compliance needs. Yes, it is possible to retrieve emails sent from a mailbox over the past 6 years in CSV or Excel format using Microsoft 365 Admin Center or PowerShell. However, retrieving such a large volume of data requires eDiscovery tools and appropriate permissions. Here’s how to do it:


    Using Microsoft 365 Admin Center

    Set Up eDiscovery Permissions:

    • Go to Microsoft Purview Compliance Center > Permissions.
      • Assign yourself the eDiscovery Manager role to access eDiscovery tools.
      Create an eDiscovery Case:
      - Navigate to **Microsoft Purview Compliance Center** > **Content Search**.
      
         - Create a new content search and name it appropriately.
      
         **Define Search Conditions**:
      
            - Set the **Locations** to include the mailbox in question.
      
               - Use a query like `sent>=01/01/2018 AND sent<=01/01/2024` to define the date range.
      
                  - Run the search and review the results.
      
                  **Export Results**:
      
                     - Once the search completes, export the results.
      
                        - Use the provided link to download the data in PST format.
      
                        **Convert to CSV/Excel**:
      
                           - Use tools like Outlook or specialized software to convert PST files into CSV or Excel.
      

    Using PowerShell

    Connect to Exchange Online:
    Run the following commands to connect:

    Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com
    

    Export Sent Items:
    Use the Search-Mailbox or New-ComplianceSearch cmdlets to export data.
    Example using Search-Mailbox:

    Search-Mailbox -Identity "user@yourdomain.com" -SearchQuery "SentItems AND after:01/01/2018 AND before:01/01/2024" -TargetMailbox "admin@yourdomain.com" -TargetFolder "SentItemsExport" -LogOnly -LogLevel Full
    
    • The above command logs all sent items within the specified date range into a folder in the target mailbox. Convert to CSV:
    Export results from the mailbox to a CSV using PowerShell:
    ```   ```
       Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | Export-Csv -Path "C:\SentEmails.csv" -NoTypeInformation
    

    Verify Email Data

    Before processing, verify the extracted email data:

    • Use an email verifier tool to validate addresses in the extracted list to ensure deliverability and correctness.
    • Example tools include email verification APIs or scripts to identify invalid or outdated addresses.

    This process ensures you retrieve the emails and have valid and accurate data for analysis or compliance needs.

    0 comments No comments

  3. Bruce Jing-MSFT 7,785 Reputation points Microsoft Vendor
    2025-01-20T09:40:20.9133333+00:00

    Hi,@Mohana Reddy

    Thanks for posting your question in the Microsoft Q&A forum.

    You can search for content in Microsoft Purview's eDiscovery.

    User's image

    User's image

    Finally, just export the results.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.