Block access to all calendars for a certain group

Copper Contributor

HI All , really hoping you can help.

 

I have been looking online and on forums for a solution but cant seem to get the right wording, as im sure someone else must have a similar issue.

 

We have some contractors in our 365 organisation that we would like to block from seeing all of the staff's calendars.

 

By default we have set that all calendars are set to view free/busy and some users have changed this to All availability or no visibility at all. Ideally we want to keep this under their control and for them to manage.

 

What we would like is some policy/ script that blocks a certain security group from viewing anyone's calendar apart from their own.

 

can anyone make any suggestions, and feel free to ask any questions if i'm not being clear!: :) 

 

Thanks in advance

 

Simon

3 Replies

Hi @simonmccarthy,

 

Presuming you have all your contractors in a security group called contractors@domain.com, you can execute the following cmdlet:

  • Add-MailboxFolderPermission -Identity "User1@domain.com:\Calendar" -User "Contractors@domain.com" -AccessRights None

 

This'll need to be executed against each user in your org. (User1, User2, User3, etc.). 

@boneyfrancis 

Thanks for this, seems a great place to start!

 

Is there a way of bulk changing this if all of the staff are in a security group also, as this will be over 300 staff to change otherwise :( 

 

Many thanks 

The Identity parameter cannot be a security group, however you can loop in through all users as follows:

1. Create a CSV file with email addresses of all the Users (User1@domain.com, User2@domain.com.. User300@domain.com listed one below the other)
2. Run the cmdlet:
foreach ($user in (import-csv <path to file.csv>)){Add-MailboxFolderPermission -Identity $user:\Calendar -User "Contractors@domain.com" -AccessRights None