Get-MgUserCalendarView "The specified object was not found in the store"

Jamro Chris 0 Reputation points
2025-01-08T14:07:57.18+00:00

I'm attempting to get info on some of our resource calendars. Since this doesn't function well within the EXO Powershell, I was pointed towards the MSGraph module.

So I use these commands:

 $StartDate = "2024-01-01T19:00:00-08:00"
>> $EndDate = "2024-12-31T19:00:00-08:00"
>> Get-MgUserCalendarView -UserId "xxx@xxx.xx" -All -StartDateTime $StartDate -EndDateTime $EndDate | Select-Object -Property @{Name='EventStart';Expression={ $_.Start.DateTime}},@{Name='EventEnd';Expression={ $_.End.DateTime}},Subject, BodyPreview | Export-CSV "c:\temp\xxx.csv"

And this works fine for almost every resource I have tried this on. But one set of resource mailboxes gives this as a result:

Get-MgUserCalendarView_List:
Line |
   3 |  Get-MgUserCalendarView -UserId "xxx@xxx.xx" -All -Star …
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The specified object was not found in the store.

Status: 404 (NotFound)
ErrorCode: ErrorItemNotFound
Date:

Headers:
Cache-Control                 : private
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : ab43f50a-55e9-49fa-a837-aca09feba628
client-request-id             : 607a9733-2835-4c51-8885-138338823e84
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"009","RoleInstance":"AM1PEPF00027CA5"}}
Date                          : Tue, 07 Jan 2025 15:22:11 GMT

This set of resource mailboxes are coincidentally all made at about the same time, but they were made in the same way as other resource mailboxes and are (just like the other resource mailboxes) made in our EXO environment with no links to anything on-prem.

Does anyone have any idea what is going wrong?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,885 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,609 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saranya Madhu-MSFT 1,245 Reputation points Microsoft Vendor
    2025-01-09T04:33:44.8533333+00:00

    Hi Jamro Chris,

    Thanks for reaching out to Microsoft!

    A NotFound error may occur if you lack the necessary permissions to access an object in the Exchange store.

    For application permissions, grant Calendars.Read to access resource mailboxes or shared mailboxes.

    For delegated permissions, ensure you grant Calendars.Read.Shared to access resource or shared mailboxes.

    Ensure that the credentials used have full mailbox access rights to the target mailbox.

    Similar posts: https://learn.microsoft.com/en-us/answers/questions/1080880/get-mgusercalendarview-for-room-accounts?page=1

    Hope this helps.

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


Your answer

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