About the error message that UserPrincipalName is invalid

ooumi77 126 Reputation points
2022-06-06T11:41:10.353+00:00

I want to refer to the calendar of someone other than myself with the Microsoft graph API.
However, if you specify the following and execute with delegated access, the error message "xxx@X .com is invalid" is returned.
In addition, "xxx@X .com" is the UserPrincipalName of a sharer other than yourself. Outlook is shared using the free version. Accounts are Microsoft accounts.
What is the cause of the error message?
By the way, if you specify your own UserPrincipalName, it will work.

https://graph.microsoft.com/v1.0/users/xxx[@](/users/na/?userId=83e82d08-687d-492d-a122-29c7f3076b43).com/calendar
(Use Calendars.ReadWrite.Shared)

Microsoft Security | Microsoft Graph
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Sheena-MSFT 1,736 Reputation points
    2022-06-06T12:22:47.577+00:00

    Hi @ooumi77 ,

    To share the calendar you can follow the below steps in outlook:

    In calendar Home page click on settings and select view all outlook settings

    208763-159669-ss2.png

    From settings select calendar ->Shared calendars ->select a calendar

    208732-159670-ss3.png

    Choose the user you want to share the calendar and add the permission "can edit" or "delegate"

    208753-159689-ss4.png

    If you have shared the calendar like the above mentioned step then please check the UPN by running the endpoint /users.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.