# Restricting access to just Calendar folders

The Cronofy calendar sync engine does not access email folders in Mailboxes.

However, it is possible to prevent this explicitly by using the `Add-MailboxFolderPermission` to specify explicit permissions for the Service Account on the end-user's Mailbox.

### Providing access to private calendar folders
The `Add-MailboxFolderPermission` cmdlet in Powershell allows you to specify folder-level permissions for users, to a mailbox. Utilise this for more granular control over what users have access to.

Start by adding a user as a calendar delegate to a calendar with access to private items via PowerShell. The example below adds [service_account@example.com](mailto:service_account@example.com) as a calendar delegate to [professional@example.com](mailto:professional@example.com) with access to private items.

```
Add-MailboxFolderPermission -Identity professional@example.com:\Calendar -User service_account@example.com -AccessRights Editor -SharingPermissionFlags Delegate,CanViewPrivateItems
```

`Editor` is the access right necessary to allow a user to create, delete and read calendar items. If you wanted the user to be able to create calendars, change `Editor` to `PublishingEditor`.

### Configuration for multiple accounts
It is also possible to add calendar folder permissions for multiple users. Start by creating a csv file with users listed within it. The csv should be in the following format...

```
alias
professional.example1@cronofy.com
professional.example2@cronofy.com
professional.example3@cronofy.com
```

Once you've created and saved the csv, run the following query against it. In the example below, the file is called `cronofy.csv`.

```
Import-Csv cronofy.csv | foreach { Add-MailboxFolderPermission -Identity &quot;$($_.alias):\Calendar&quot; -User service_account@example.com -AccessRights Editor -SharingPermissionFlags Delegate,CanViewPrivateItems
```

This will set the required permissions for each of the accounts listed within your csv file to the specified level.

> **WARNING:** The calendar name in the Powershell command above, `Calendar`, must match the name of the actual calendar for that user. For example, German customers may need to replace `Calendar` with `Kalender`.

### Further reading
Further information on the the Add-MailboxFolderPermission and additional parameters is [available from Microsoft](https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/add-mailboxfolderpermission?view=exchange-ps).

If you require any further assistance, feel free to contact us at [support@cronofy.com](mailto:support@cronofy.com).


---
[Read in HTML](/calendar-admins/enterprise-connect-office365-exchange/adding-mailbox-folder-permissions/)
