Graph return ItemNotFound when updating event throught me/evet/id

Meriem Djouaher 41 Reputation points
2022-10-18T22:35:19.313+00:00

Hi,
We are a team of developers trying to integrate the Graph API v1. 0 for one of our applications.
Before using Graph, the application was using EWS services throughout the Exchange library for Java, specifically Appointment class, allowing the users to create, update and delete event on an outlook calendar.
As specified in the documentation when creating an appointment, we save the appointment ID that will be used later to update/delete the created event.
When using Graph API v1.0 to update/delete, we use the event resource type with the Uri /me/event/{event_id}.
To reduce the impact of using Graph instead of EWS, all events created before the integration of Graph should be updatable. Therefore, one of our test cases was to create an event through the EWS library, save the id and use it to modify the event with Graph. However, Graph response is not a success. The returned error code was ErrorItemNotFound and the error message was, "The specified object was not found in the store".
Here are some additional information to consider:
• The event created with EWS uses an on Premise account and the graph uses an On Cloud account. These accounts are different and not related.
• The creation of the events when using EWS is done on the OnPremise server through an On Premise account
• The management of the events when using Graph API is done through an On Cloud account that has the following permissions:
o User.Read : Delegated through admin consent
o Calendars.Read : Delegated through admin consent
o Calendars.ReadWrite : Delegated through admin consent
• The management of the events when using Graph API is done through me/event for creation and me/event/id for modification
• Using the translateID API to convert the IDs from EWS to Graph does not resolve the problem
• When using the same OnCloud account than the on Graph with EWS online and after using translateID I can modify the created event in EWS

We were wandering if you would be able to help us identify what could cause this error.

Exchange Exchange Server Management
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Glen Scales 4,446 Reputation points
    2022-10-19T23:02:57.383+00:00

    • The creation of the events when using EWS is done on the OnPremise server through an On Premise account

    • When using the same OnCloud account than the on Graph with EWS online and after using translateID I can modify the created event in EWS

    If your creating an Event (or any item) in an OnPrem mailbox then you won't be able to access that OnPrem mailbox item using the Graph, one exception is if you have hybrid graph access configured but this is being depreciated https://learn.microsoft.com/en-us/graph/hybrid-rest-support. But going forward you want to make sure your application doesn't use the Graph to access OnPrem mailboxes as this will break in the future.


2 additional answers

Sort by: Most helpful
  1. Glen Scales 4,446 Reputation points
    2022-10-20T23:11:06.107+00:00

    Thank you very much for this fast response! This would explain the error indeed. If I summarize, when adding an item (in my case it would be an event), EWS would create an Item in the CalendarFolder which is related to a mailbox. Therefore, if the account used to perform the meeting creation has an On Premise mailbox all folders (calendarFoolder in our case) and all items that were created in those folders are in the mailbox, and can not be extracted with Graph?

    The important point in the location of the items if they are in an OnPrem mailbox then you can't use Graph to access them. An OnPrem account could still access mailboxes that are in the cloud and create items etc and they would be accessible because those mailboxes are hosted in o365

    Also, we are thinking of transferring the OnPrem mailbox to the cloud. Would this be a suitable solution? our concern for this, is that the ItemIds in the CalanderFolder and all Ids related to emails will be regenerated in Exchange Online?. This would solve our problem with graph as I think the translaterId API allows us to translate from ewsId format (Exchange On line) to restId( Graph). However, if the ids are regenerated we would lose the connection with the user as if no mapping is done between the Id when the mailbox was On Prem and the new Ids when the mailbox in Online

    If you don't need to support onPrem mailboxes then having everything in o365 means you should be able to remove the EWS part of your code which should make your app more easy to maintain in the future (I would suggest switching to imuatableId's in that case as well). When you move the Mailbox this will change the ewsId's there's no way of avoiding this so you need to come up with a way or migrating it that supports your backend (eg custom prop on the item, or map the GOID https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidlidglobalobjectid-canonical-property etc)


  2. Glen Scales 4,446 Reputation points
    2022-10-24T05:19:13.46+00:00

    One last question for my own understanding. If I create an event through CalendarItem in EWS, it is automatically added to the mailbox of the organizer ?

    By default if your using or impersonation the organizers mailbox it will be saved to the their calendar when sent but its may not behave the way you thinking so i would suggest you test it


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.