How can I move a schedule excluded from retention tag to archive using powershell scripts

gihyun Park 65 Reputation points
2023-06-20T06:56:48.3433333+00:00

Hi

I changed the 'ELCAssistantCalendarTaskRetentionEnabled' value to 0 in regedit so that the schedule does not apply to retention policy. in Exchange 2019 Onpremise

but, Now I want to move the schedule to archive at a different interval from retention policy.

I looked for a method with search-mailbox or several commands, but I decided not to use them.

I installed EWS API, An error occurred while the command was in progress.

///

C:\Windows\system32>$folder = [Microsoft.Exchange.WebService.Data.Folder]::Bind($service,$folderid)

Error: Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. The remote server returned an error: (401) Unauthorized

///

-summary

  1. How to Resolve Errors? (Is it possible in the way I'm proceeding?)
  2. How can I move a mailbox schedule(calendar) to archive? (It is rather good if there is a other better way from the above.)

Thanks

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,258 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
540 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,599 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,508 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,458 questions
0 comments No comments
{count} votes

Accepted answer
  1. Aholic Liang-MSFT 13,846 Reputation points Microsoft Vendor
    2023-06-21T09:23:41.62+00:00

    Hi @ gihyun Park ,

    Do you want to move your calendar to the archive mailbox with different settings than in DPT?

    If this is the case, you can create a new retention tag that is moved to the archive, add it to the retention policy, then add this policy to the mailbox and apply it to the calendar folder.

    In addition, according to my search, the registry ELCAssistantCalendarTaskRetentionEnabled only works in the Exchange 2010 environment and does not work in Exchange 2016: Prevent Calendar items from archiving and deleting (Retention tags) - Microsoft Q&A


    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.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Limitless Technology 44,221 Reputation points
    2023-06-20T15:50:30.6133333+00:00

    Hello Gihyun,

    Thank you for your question and for reaching out with your question today.

    To resolve the "401 Unauthorized" error while using the EWS API to move a mailbox schedule/calendar to the archive, you need to ensure that the account running the script has the necessary permissions. Here are a few steps you can take to troubleshoot and resolve the issue:

    1. Confirm that the account running the script has the required permissions:
      • Make sure the account has the ApplicationImpersonation role assigned. This role allows the account to access and manipulate mailbox data on behalf of other users. You can assign this role using the Exchange Management Shell with the following command:
        
             New-ManagementRoleAssignment -Name "ImpersonationRoleAssignment" -Role ApplicationImpersonation -User <AccountName>
        
        
      • Ensure that the account has sufficient permissions to access and modify the target mailbox and its calendar items.
    2. Verify the credentials used to connect to Exchange:
      • Double-check the username and password used in the script to connect to Exchange. Ensure they are correct and have the necessary privileges.
    3. Check if the Exchange Web Services (EWS) virtual directory is configured correctly:
      • Confirm that the EWS virtual directory is properly configured in Internet Information Services (IIS). Ensure that authentication methods are correctly set and that the virtual directory is accessible.
    4. Ensure the EWS URL is correct:
      • Verify that the URL used to connect to the Exchange Web Services is accurate. It should be in the format: https://<ExchangeServer>/EWS/Exchange.asmx.

    If the issue persists after performing these steps, it's recommended to review the EWS API documentation, consult with your Exchange administrator, or contact Microsoft support for further assistance.

    Regarding moving a mailbox schedule/calendar to the archive, using the EWS API is one way to achieve it. Alternatively, you can explore other methods such as using PowerShell cmdlets specific to Exchange Online (if applicable) or utilizing third-party tools that provide advanced mailbox management features.

    Remember to thoroughly test any scripts or changes in a non-production environment before implementing them in a live environment.

    I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.

    If the reply was helpful, please don’t forget to upvote or accept as answer.

    1 person found this answer helpful.

  2. Vahidə Azayeva 0 Reputation points
    2023-07-24T02:41:57.05+00:00

    The answer to this question was also interesting for me. Thank you for your reply

    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.