Forum Discussion

Thomas_Stephens's avatar
Thomas_Stephens
Copper Contributor
Jul 12, 2023

Listing ExternalItems to Delete Stale Items from Search Index

We are developing an MS365 search extension which, periodically populates `externalItem` records from records in an external system. Creating the new records works fine, but we are having a problem deleting records for items that no longer exist (or are no longer accessible to the integration).

 

Our plan was to list the `externalItem`s from the Graph API, and delete any that we didn't find while running the sync. However, we can't get this to work, because the only way to list `externalItem`s is via the search API, but it is not possible to search for `externalItem`s using Application Permissions. The error we get is:

 

 

"Application permission is only supported for the following entity types:site, list, listItem, drive and driveItem."

 

 

Is there any other way for an application to list existing `externalItem`s from a given connection? What other strategies can we use to delete stale items from the index? Note that it is not possible for us to query the external system for the items that we cannot access.

Resources