0

We have an Outlook add-in that can be opened in ItemRead view.

This add-in sends requests to the Outlook REST API api/v2.0/me/messages/{message-id} endpoint to get further details on the currently viewed mail item.

We obtain the message ID for the request by calling convertToRestId on the office-js SDK with the itemId value of the current mail item.

We obtain the auth token for the request by calling getCallbackTokenAsync with isRest: true.

Despite the user currently being on the read item view for this item, we are getting a number of 404 responses from the REST API that the message is not found.

{
  error: {
    code: ErrorItemNotFound, 
    message: The specified object was not found in the store., The process failed to get the correct properties.
  }
}

I have been unable to reproduce this on any of my test accounts but this our most commonly reported issue in Sentry. It seems this can happen quite frequently

What could be the cause for this and is there any way to work around it?

I see a report of a similar issue here but there was not much response: ErrorItemNotFound error for message resource, but found when OData filter applied

  • On which platforms do you see this error (i.e. Windows/Mac/Web)? And about what % of messages are returning this error? – Outlook Add-ins Team - MSFT Jun 01 '21 at 01:50
  • @OutlookAdd-insTeam-MSFT it's difficult to assign a specific percentage to this but I see around 100 reports of it happening every week. I see this reported against OWA, Outlook for Windows and Outlook for Mac. I see it against both OutlookCom and Office365 account types. – David Fishlock Jun 02 '21 at 14:26
  • The behavior you are seeing can happen in some cases, like when the message is moved or the message is deleted. This is more likely to happen in Outlook for Windows since there's more of a delay in syncing data back to the server. – Outlook Add-ins Team - MSFT Jun 08 '21 at 14:18
  • @OutlookAdd-insTeam-MSFT it seems very unlikely that this explains the number of reports I am seeing of this. The user is actively looking at the email in the read item view when we make the request. We also see a number of reports of this against OWA where I don't think a sync delay explains this at all. – David Fishlock Jun 10 '21 at 13:25
  • @OutlookAdd-insTeam-MSFT any further response on this? It seems unlikely that we are seeing such a significant number of reports of this just from users who have moved an email immediately before opening the add-in. Especially on OWA it doesn't seem like this could really happen there. – David Fishlock Jun 21 '21 at 13:40
  • We took a look at our internal logs, and couldn't find ErrorItemNotFound logged in the numbers you mention. Are you on an OnPrem Server? Or some other enclosed/secure server that we don't have access to the logs? Is your add-in a store add-in? (or are you sideloaded/admin installed/etc.) Are you ok with sharing your Add-in Id with us? Is it possible that you are getting other errors than ErrorItemNotFound? Also is that message you receive consistently the one you mention above? Does the message for the error ever change? What Permission level is your Add-in? ReadWriteItem? ReadWriteMailbox? – Outlook Add-ins Team - MSFT Jun 22 '21 at 02:23
  • More questions: Is there anything unique about the failing scenarios? Are your users on a shared mailboxes/shared folders when they encounter the error? (does your add-in supportsharedfolders?) When a user hits this error, do they consistently fail with that error? Or is it intermittent? (i.e. the next time they you call the API, it succeeds?) – Outlook Add-ins Team - MSFT Jun 22 '21 at 02:25
  • Our add-in is available in the store and so is available for install for all account types and clients that support the minimum 1.5 requirement set. We do not declare support for shared folders in the manifest, although some users have mentioned that they are receiving issues with 'shared emails' despite us not declaring support. The number of users mentioning this does not appear to account for the number of issues we are seeing so I think this may be confusion on their part. I've been unable to reproduce a scenario where our addin is displayed in a shared context. – David Fishlock Jun 22 '21 at 13:53
  • As far as I can tell, when a user encounters this on an email it is consistent. I have tried to hit some of my own emails thousands of times to try and reproduce some intermittent error with no success. We do see some other errors codes but much less frequently. The vast majority are of this type. I am capturing the error response to Sentry when this occurs and the error is as displayed above. Our addin is displayed in the message read view, so has ReadItem permissions. The store ID is f943a864-d306-40c4-b147-6b9b4ab79757. – David Fishlock Jun 22 '21 at 13:53
  • To update, we are trying to find out more about this error from our Server Logs, but we are not seeing any of these errors. (we see a small number of ErrorMailboxMoveInProcess, ErrorMailboxStoreUnavaliable, ErrorAccessDenied, and MailboxInofStale) (less than 100 total). – Outlook Add-ins Team - MSFT Jun 25 '21 at 02:26
  • We will need to do some more investigation, but want to confirm: the AppId (not storeID) of your app is: d6072c51-72e9-4bbb-a34b-0dcaad6bf00c, and the permission level of your add-in is ReadWriteItem. (Permission level affects how we look up the query on the backend), Also that you are seeing it on OfficeCom/Office365 but NOT Enterprise. – Outlook Add-ins Team - MSFT Jun 25 '21 at 02:27
  • A "workaround" for this, could be that when you hit this error, you could try getting the item via an EWS call (either with the EWS token) or via makeEWSRequestAsync. – Outlook Add-ins Team - MSFT Jun 25 '21 at 02:42
  • (As an update, we found that our summary logs weren't logging ErrorItemNotFound, and we have to dig in deeper to look at raw logs). I unfortunately cannot provide an update as to when the product team will be able to investigate this further. – Outlook Add-ins Team - MSFT Jun 25 '21 at 18:45
  • Yes sorry the Id in the manifest is d6072c51-72e9-4bbb-a34b-0dcaad6bf00c and permissions set in the manifest is ReadWriteItem. We are only seeing this on OfficeCom and Office365, but only because we do not make this request for Enterprise users as we found on-prem servers to not be configured for CORS and so the requests would always fail. The related functionality is disabled in our addin when the account type is Enterprise. Switching to EWS is not a great workaround since this is not supported on mobile. At this point it's unclear why this would give a different result from the REST call. – David Fishlock Jun 28 '21 at 14:17
  • Hi, I am working on one of the development and I get similar error. We save the item and then retrieve the item using function file and then this error pops up (we are doing this because getasync doesn't give the pictures imagebytes, so we need to call the api t get image bytes https://stackoverflow.com/questions/39415633/outlook-add-in-image-files/42559465?noredirect=1#comment121132132_42559465 ). The error doesn't occurs in outlook web but in outlook application. Is there any workaround for the same? – SabVenkat Aug 01 '21 at 18:28

1 Answers1

1

For ErrorItemNotFound, we've investigated this error in the past, and it always correctly indicates that the item is not present on the server. There are a variety of ways this can happen, and some cases are transient while others are permanent.

Based on data collected earlier, I would expect about 1% or fewer GetItem requests to return ErrorItemNotFound. The error rate could vary across add-ins since the transient cases would depend on when the user interacts with the item.

When a user or service moves an item to another folder (i.e. archiving, deleting, or triaging an item), this causes the id of the item to change. An ItemNotFound error could be returned by an add-in running on a different client with an out-of-date view (even if the item appears on the user's screen, and they are able to run an add-in on it). Or, it could be returned by an add-in running on the same client if the move hasn't been synced to the server.

Clients with cached/offline data, like Win32 Outlook running in cached mode can experience transient ItemNotFound errors. If Outlook hasn't run in a while, or the user just configured their mailbox, Outlook could have a large number of items to sync, and this can delay syncing any changes to items or new items up to the server. If it's syncing other items, or temporarily disconnected from the server, it could allow the add-in to run before the item is available on the server. The item could be for a newly created item, or an item that was moved (i.e. archived/deleted/or otherwise triaged by the user).

Win32 Outlook has the ability (through MAPI) to return item ids that aren't available yet on the server. This is most noticeable when composing an email, but could also impact Read scenarios like in the following example.

I've personally seen this happen in Win32 Outlook after sending a message and opening it (in Read mode) from the Sent items folder (while Outlook was busy syncing items in other folders since I hadn't used that laptop in a few weeks). Outlook could have created the item there locally rather than downloading it from the server as you might expect.

If an add-in relies on data available both locally and from a server, it could provide reduced functionality, or show an error that the item can't be retrieved from the server.

If a service performs an asynchronous operation on an item from its backend, it could hold onto the request and try again later. But, since some portion of these errors are permanent, there's no guarantee that the request will succeed later.