Hi @Michal Dejmek ,
The school wants the students to not see the teachers in the directory and vice versa.
According to your description, the first requirement is that you can create two address book policies to enforce. When an ABP is created and assigned to a user, the ABP becomes the scope of the address list that the user will be able to view.
You can refer to the following links to learn about and create:
Address book policies in Exchange Online | Microsoft Learn
Create an address book policy in Exchange Online | Microsoft Learn
Students are also not allowed to see other students..
You can hide a student's email address from the address book with the following command:
Set-mailbox -identity user -HiddenFromAddressListsEnabled $true
Or enable it for each student mailbox in EAC in the following way:
1. open EAC , enter Recipients-Mailboxes
2. select the specify the mailbox
3. click “Manage hide from GAL ”
4. Enable and save it.
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