how to move calendar items that are more than a year old to archive?

gihyun Park 65 Reputation points
2023-08-23T06:53:32.84+00:00

Hi

★Is there a way to move calendar items that are more than a year old to archive?★

I'm using retention policy for the mailbox.

Policies moving to archive cannot be set for each folder.

The version is exchange 2019 and on-premise.

It would be nice if it could be possible with exchange powershell, but it seems impossible.

I would appreciate it if you could let me know any way.


I'm studying how to use EWS API

There's no blog that tells how to use it in detail

$folder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid)

From the above command, I have succeeded in specifying a calendar folder for $folderid.

I don't know if it's possible to solve it in this way.

If possible, please let me know what I should do afterwards.


EWS API is simple to use through import-module in powershell

I don't even know how to use a code made with java or c#

Thank you.

Exchange | Exchange Server | Other
Exchange | Exchange Server | Development
Exchange | Exchange Server | Management
Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Jarvis Sun-MSFT 10,231 Reputation points Microsoft External Staff
    2023-08-24T08:34:55.9166667+00:00

    Hi @gihyun Park ,

    Thanks for posting in our Q&A forum.

    It seems impossible from server side.

    From client side, it is suggested that you can export your calendar items to a .pst file and then import them to your archive folder.

    And a source explains how you can use the AutoArchive feature in Outlook to move items from your active folders to an archive folder. Please refer to: https://support.microsoft.com/en-us/office/autoarchive-settings-explained-444bd6aa-06d0-4d8f-9d84-903163439114

    I'm not clear how to implement by EWS.


    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

  2. Amit Singh 5,306 Reputation points
    2023-08-25T07:07:34.1033333+00:00

    Below is an example of the complete PowerShell script:

    Import-Module ExchangeWebServices
    
    
    $mailboxId = Get-Mailbox ******@domain.com | Select-Object Id
    $calendarFolderId = Get-MailboxFolder $mailboxId Calendar | Select-Object Id
    
    
    $service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService
    $service.Bind($mailboxId)
    
    
    $items = $service.FindItems($calendarFolderId, "CreatedDate lt '2023-08-25'")
    
    
    foreach ($item in $items) {
      $item.MoveToArchive($mailboxId)
    }
    
    $service.Close()
    
    

    This will help to solve your problem.


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.