How can I distinguish Office365 and regular Outlook user via GraphAPI?

Anton Dev 6 Reputation points


I'm building a stand-alone application that is connected to GraphAPI via OAuth.
As a part of this app, I want to build an URL, which will lead a user to the page for creating a new Outlook Calendar event with some data being prefilled.
It works fine, but I have noticed, that regular Outlook users and users of Office365 have different URLs ("" vs "").
The question is - how can I find out that the current user is using (or not) Office365 so I can build a URL with a correct domain?

Thanks in advance.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,124 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anton Dev 6 Reputation points

    As a temporary solution, I ended up checking the email domain to be one of:

    ' .',
    '@Karima ben .
    '@Luxsparks .',
    '@Microsoft Corporation .

    It will do for most cases.
    But this will not work if the user is using his own email (e.g. Gmail) for registration in the Outlook calendar.

    So now the question is:
    I have two Outlook calendar users

    • one registered with xxx@Stuff .com email
    • one is using Office365 and has email like xxx@Hanes

    Is there a way to distinguish these two using GraphAPI?

    1 person found this answer helpful.
    0 comments No comments

  2. Danstan Onyango 3,816 Reputation points Microsoft Employee

    You can try checking for the userType field of the user resource as for work or school accounts, this will either be member or guest while the personal accounts dont have this field. I am not 100% sure of this answer. You can also consider filling a feature request on Microsoft 365 Developer Platform

    1 person found this answer helpful.
    0 comments No comments