New version delete from storage

Hello,
Delete by Id method of PersonalStorage which is added in 23.7, does support removing items from Ost files too? Or only Pst supported?

Also, it can be used for single items only? Or folders also can be passed?

I use this options to load as write enabled. if correct?
Dim opt As PersonalStorageLoadOptions = New PersonalStorageLoadOptions With {.LeaveStreamOpen = False, .Writable = True}

Thanks.

Hello,

The API supports OST modifying except 2013/2016/2019/2021 and future versions.

This method provides a way to delete folders or messages.

It is correct.

1 Like

Hello,
Can you please be so kind and give me a code snippet that in case of Folder removal returns the number of successful deleted items?

And kindly share your idea about making this useful method a Function As Integer/Long to return the number of successful deleted items? (rather than a Sub)
This return number for single Mapi items will be 1 on success and number of successul deleted items for Mapi folders, this return data is pretty important and ALSO can be used to verify the operation :slight_smile:
Thanks.

Hello,
Kindly advise when opening Ost files, how to detect their creator version and find it’s a 2010 or 2013+ Ost file?

The strange thing is that when I run it against a new Ost file, when running on hidden items like IPM.Microsoft… I will get this error: The entryId is incorrect. (while it is correct, wrong message)

But running on regular known items: The method or operation is not implemented. (now I know this is expected)

Thanks.

Hello, is this a bug?

Dim MyFolderInfo As Email.Storage.Pst.FolderInfo = MyStorage.GetParentFolder(Id)
MsgBox(MyFolderInfo.ContentCount.ToString)
Storage.DeleteItem(Id)
MsgBox(MyFolderInfo.ContentCount.ToString)

FolderInfo.ContentCount is the same before and after running Storage.DeleteItem(Id)

Because PST.Store.GetTotalItemsCount will update immediately!

If so, how to get the FolderInfo.ContentCount using property extraction, instead of .ContentCount method?
Thanks :slight_smile:

It is not possible to update the MyFolderInfo object state by calling the delete method from PersonalStorage!!!
You should retrieve this folder again for example by calling GetFolderById

1 Like

Thanks, solved, the only thing is detect if Ost version is up to 2010 (supported) or 2013+ (partial supported)

If you liked, check incorrect error message thing too, because it might happen for Ost files which are build using Outlook 2010 and older (I have not one now to test)

And the suggestion of Storage.DeleteItem as Function to return integer deleted items count (if you think it’s useful - I have no use of it anymore)
Best :slight_smile:

An exception is thrown when trying to edit new versions of OST.

I don’t think it makes sense, since only one item will always be deleted if the operation is successful.

1 Like

Hello,
Yep, 1st, the exception has different descriptions for different items of the same ost file, can be misleading, as I mentioned, trying to remove the IPM.Microsoft…xxx items will throw exception with this text:
The entryId is incorrect.
While it is correct, and the error should be: The method or operation is not implemented.

Please confirm if Storage.Delete method does support hidden FAI items?

If used on a folder, multiple items are deleted.

Can you provide an example? It should be a NotImplementedException.

No, it doesn’t work with FAI

If you call a method from FolderInfo, you can check the ContentCount property

1 Like

Hello,
Thanks for the valuable info.

Load a new ost and pass one of the FAI items which are hidden to the Storage.Delete method, you will get ( The entryId is incorrect. ) error , instead of not implemented.

oops, how to delete such items? :frowning:
Will storage.delete method get this ability eventually?

You made it clear that its ContentCount won’t be updated:

MsgBox(MyFolderInfo.ContentCount.ToString)
Storage.DeleteItem(Id)
MsgBox(MyFolderInfo.ContentCount.ToString)

Both MsgBox numbers will be the same :slight_smile:

we don’t delete, modify, or add FAI items. And we don’t plan to implement it. This is due to the poor of information about the internal structure of such elements.


Please read carefully:

But in case of Storage.DeleteItem, only 1 item is always deleted. And It is not possible to update the MyFolderInfo object state by calling the delete method from PersonalStorage.

1 Like

Thanks for making it clear.

It’s quite wise to show the proper error text then:

Load a new Office 2013+ Ost and pass one of the FAI items which are hidden to the Storage.Delete method, you will get ( The entryId is incorrect. ) error , instead of the correct error:
The method or operation is not implemented.

If you don’t mind, can you please advise once we have an storage and entryID as string, is it possible to find out if the Mapi Item belonging to this entryID is a regular item or FAI hidden one?

Also are those FAI items only inside Ost files? I didn’t notice them inside Pst storages?

I don’t know that way.

I can’t be sure.