Forum Discussion

Andreas Schlüter's avatar
Andreas Schlüter
Copper Contributor
Mar 29, 2019

Graph API - validate mail nickname

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/directoryobject-validateproperties.md).

 

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

  • Kevin_Morgan's avatar
    Kevin_Morgan
    Iron Contributor

    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.

    • Andreas Schlüter's avatar
      Andreas Schlüter
      Copper Contributor

      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!

      • Kevin_Morgan's avatar
        Kevin_Morgan
        Iron Contributor

        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).

Resources