Forum Discussion

Dragan_Krstic's avatar
Dragan_Krstic
Copper Contributor
May 21, 2024
Solved

Identifier(s) in API calls to load mail folders and mails from folders

 

Hi all.

 

I am trying to load user folders with https://learn.microsoft.com/en-us/graph/api/user-list-mailfolders?view=graph-rest-1.0&tabs=http , and later emails for given folder with https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http .
In both calls common part is:

GET /users/{id | userPrincipalName}...

On Azure portal userPrincipalName parameter is editable:

Is it a must to use Object ID (below) for accessing user and so forth ?

For my use case it would be of great benefit to use User principal name , but what happens if someone changes it ?

 

Thanks in advance,
Dragan



 

  • You can use UPN in some (not all) calls, but it's best to stick to the objectID indeed.

2 Replies

  • You can use UPN in some (not all) calls, but it's best to stick to the objectID indeed.
    • Dragan_Krstic's avatar
      Dragan_Krstic
      Copper Contributor
      I need only the following two:
      GET /users/{id | userPrincipalName}/mailFolders/?includeHiddenFolders=true
      and
      GET /users/{id | userPrincipalName}/mailFolders/{id}/messages

      Any idea on how can I check this deeper?

Resources