With the LMS365 API it's possible to get the login name of a user as well as a group. This article provides description of the steps to get the relevant login name.
To get the login name of a user or a group follow the steps below:
2. Find the Users section, expand it, find the GET method /odata/v2/Users with the Returns the list of Users description and then click Try it out in the top right corner.
3. Select Execute to run the request.
You can use query options parameters to control the data in the response by setting filters. When query options parameters are set, the response will contain additional data and details which you can use for search.
4. Go to the Responses block to check the results:
- Number 2xx (for example, 200) under Code shows that the request worked correctly.
- In the Response body field, you will see all users of the tenant and their data including login names specified in the LoginName line.
- Search via Ctrl+F for a specific user or group. You can use the Download option to save the results of the API request in the JSON format to your computer.
Here are some examples of how the login names for a user or a group will be displayed in the response:
- Login name of a user
- Login name of a Microsoft 365 group
- Login name of a Security group
In some cases, we recommend using DirectoryObjectId instead of LoginName.
DirectoryObjectId is a unique identifier in Azure Active Directory, always remains unchanged even when the login name of the object is modified is allows the system to easily identify the user.
DirectoryObjectId can be found in the same response as for the user login name.