다음을 통해 공유


Migrating Exchange 2007 Calendar Permissions to Exchange Online

When you're migrating from Exchange 2007 to Exchange Online you will likely bump into the problem that the calendar sharing permissions will not be migrated to Exchange Online. Users will only see Free/Busy information from other users when opening a calendar from another user. 

You have two options to get these permissions back into Exchange Online:

  1. Ask your users to manually recreate them OR:

  2. Follow the steps below to get them back

Basically, the cause of the issue is (probably) that Exchange 2007 has no mechanism to export the mailbox folder permissions in Powershell, therefore it appears that there is no mechanism to retrieve them and move them to Exchange Online. 

So what you need to do in general steps:

  • Install an Exchange 2010 CAS Server and connect it to Exchange 2007 server

  • Use Powershell on the newly installed 2010 CAS server to export the Calendar folder permissions from Exchange 2007 with the Get-MailboxFolderPermissions Cmdlet and store the result in a CSV file

  • Use Powershell on Exchange Online to import the permissions that were exported in step 2.

    1. Install Exchange 2010 CAS Server and connect it to Exchange 2007 Server

    You will need an extra server or a virtual server with Windows 2008 R2 installed on it. It should be domain joined on the same forest where the Exchange 2007 is running.

    See this article on how to perform the required steps to complete the task. If the installation succeeded, you should be able to connect with Powershell from the newly installed Exchange 2010 CAS server and run the following command:

    GET-MailboxFolderPermission -Identity "<UserPrincipalname>:\Calendar" 

    Replace the <Userprincipalname> with the Userprincipalname from existing mailbox.

    It should return the folderpermissions granted to the calendar of the user.

    Note that if you have users that have been using a language different than English, you should replace 'Calendar' with the name of the calendar of the language that was used. For example, if the language of the user was Dutch, it should be:

    GET-MailboxFolderPermission -Identity "Ed@Contoso.com\Agenda"

    2. Use Powershell to export the permissions to a .CSV file

    Use the following script to export the calendar permissions from Exchange 2007. Use the Exchange Management Shell from the Exchange 2010 CAS server that you installed in step 1:

    $Mailboxes = Get-Mailbox -ResultSize Unlimited | Select Alias

    $AllCalPermissions = @()

    $CalPermissionAtt = "" | Select Mailbox,Identity,User,AccessRights

    $Mailboxes | ForEach-Object {

        $User=$_.Alias

        $Path=$User+”:\Calendar”

        foreach ($CalPermAccessRights in Get-MailboxFolderPermission –identity $Path) {

           $CalPermissionAtt.Mailbox = $User

           $CalPermissionAtt.User = $CalPermAccessRights.User

           $CalPermissionAtt.AccessRights = $CalPermAccessRights.AccessRights

           $AllCalPermissions += $CalPermissionAtt | Select Mailbox,User,@{l='AccessRights';e={$_.AccessRights}}

        }

    }

    $AllCalPermissions | Export-Csv C:\Temp\CalendarPermissions.csv -NoTypeInformation 

    Make sure to change the path to the .csv file in the last line to an existing location on the machine where you run the script.

    When this script completes you should have a .csv file with the exported permissions. You can use this in step 3 to import it to Exchange Online.

    3. Use Powershell to import the permissions into Exchange Online

    When importing the CSV you should have three columns that should be used to execute the Add-MailboxFolderPermission Cmdlet. You need the name of the Calenderfolder that needs to be changed, the user who will be granted access and the permission level. Depending on the import file that you have and the way that users permissions were granted you may have either security groups or user accounts that had been granted access to the Exchange 2007 calendars. You will probably have to split your CSV file into two files: one file which contains only the security groups that need to be granted access and a second file that only contains the single users that had been granted access in Exchange 2007.

    1. First add these commands to log on to your Office 365 tenant:

    $O365Cred = Get-Credential

    Import-Module MSOnline 

    $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection 

    Import-PSSession $O365Session

     

    1. Run the following Powershell commandlets in Exchange Online Powershell to grant the security groups access from the import file:

    $Users = import-csv C:\Temp\CalendarPermissions.csv

    $Users | Foreach{

        Add-MailboxFolderPermission -Identity $_.Mailbox -User $_.User -AccessRights $_.AccessRights

    }

    3. Run the following Powershell commandlets to grant single users access from the import file:

    $Users = import-csv C:\temp\IsahCalendarGroups4.csv

    $Users | Foreach{

        $userId = Get-msoluser|Where-Object{$_.DisplayName -like $_.user}

        Add-MailboxFolderPermission -Identity $_.Mailbox -User $_.User -AccessRights $_.AccessRights

    }