Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community

Graph API - validate mail nickname

Brass Contributor

Hey Folks,

 

anybody who can me Point in the Right direction?

 

I want to check a mail nickname for creating an Office 365 Group via Graph API before the Group will be created, so that the requester could Change the nickname, if it´s unavailable.

 

I have found out, that you could do this via directoryObject/validateProperties (https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/api/directoryo...).

 

I have tried to test that via Graph Explorer but I do not get it to work.

 

The goal is to implement this in my flow for requesting and creating a new Team in Office 365.

 

Thank you!

4 Replies

@Andreas Schlüter 

 

PowerApps – Custom Connectors

 

This article explains creating a custom connector using Office 365 graph APIs and later integrating it with PowerApps and you can find your query as well.  Happy reading..

@Andreas Schlüter 

 

Have you tried this under beta endpoint, seems this api still not supported in production endpoint (v1.0) and the reference you mentioned here also pointing to the beta endpoint.

 

Both success (mailNickName available) and failure (mailNickName already used) cases are working fine for me in Graph Explorer. Attached the results.

 

Since you have mentioned about Flow, hope you can use the Status Code (Success: 204) to move forward through Flow.

@Kevin Morgan,

 

thank you very much for your Input!

What User-ID do I have to take for "onBehalfofUser"?

And how do you check the mail nickname against the Directory? Maybe, the nickname is not in use for a Group but otherwise for a distributionlist or an alias of a user?

Thanks!

@Andreas Schlüter 

 

User-ID : The UserID is Id of the user who is going to create group. Most probably, it should be the current user, so you can get it ("id" property) from "me" endpoint (https://graph.microsoft.com/v1.0/me).

 

mailNickName : The mailNickName is nothing but the mail alias for the new group that you are going to create (for ex: if you want your new group email address like "o365Group@contoso.com" - then here 'o365Group' is nickname).