PersonalStorage.FindAndEnumerateSoftDeletedItems() - guaranteed order?

For the same PST file, is PersonalStorage.FindAndEnumerateSoftDeletedItems() guaranteed to return soft-deleted items in the same order each time it’s called?

I want to be able to recover processing of a PST if a crash occurs. If the the return order is guaranteed then I can use the index into the list to recover.

@weswes

The PersonalStorage.FindAndEnumerateSoftDeletedItems() method does not guarantee that soft-deleted items will be returned in the same order each time it is called. The order of the returned items can vary due to factors such as the internal structure of the PST file and the manner in which items were deleted.

Cause: The variability in the order of returned items is inherent to the method’s design and the underlying data structure.

Solution: To manage this variability and prevent potential crashes during processing, implement a mechanism to track the index of the items you have processed. You can store the results in a list or a database, allowing you to resume processing after a crash. This approach ensures that even if the order changes, you can reference the items based on their indices or unique identifiers.

Next Steps: Begin by designing a tracking system that records the indices or unique identifiers of processed items. Test this system to ensure it effectively allows for recovery after interruptions.

If you have any further questions or specific requirements, please let me know!

If the order is not guaranteed, then recording indices will not help. There’s also no entryid returned with the items returned by this method, so I’m not sure what “unique identifiers” I would record.

Hello @weswes,

Just to clarify, does the PST file remain unchanged between calls to FindAndEnumerateSoftDeletedItems()?
Any modifications (e.g., deletions) may affect the order of soft-deleted items and make it unreliable to depend on the order.

Also, it would be helpful if you could share more details about your use case.
Thank you.

Hi @margarita.samodurova,

Yes, I’m referring to the case when the PST file remains unchanged between calls.

The use case is to simply export all of the messages from a PST. If the export is interrupted for any reason, I want to the application be able to resume where it leftoff.

Since entry IDs aren’t exposed for soft-deleted messages, I’m looking for how I can record progress. If the order remains the same then I can just use an index.

Thanks.

Yes, if the PST file remains completely unchanged between calls, then using the index from FindAndEnumerateSoftDeletedItems() can work to track progress.