Click here to Skip to main content
15,844,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to process an exchange mailbox and export some of its items to a PST file.

I'm adding a pst store and a new subfolder:

For Each i As Outlook.Store In NSpace.Stores
           If i.FilePath = FileName Then
               PstRoot = i.GetRootFolder

and then:
subfolder = PstRoot.Folders.Add(folderName)

I'm fetching the items from the exchange server (direct connection to it):

Public exch_glob As New Microsoft.Exchange.WebServices.Data.ExchangeService()
itemList_Glob = exch_glob.FindItems(ExchFldrID, BigitemView)

For Each i As Item In itemList_Glob

These parts are working fine.
I'm unable to move a message from the exchange to this PST.

Any help will be appreciated!

What I have tried:

I did try all kind of syntaxes like

and many others, but something is just not right. :(
Updated 3-Nov-23 5:39am
Richard Deeming 2-Nov-23 11:30am    
NB: If you're using Outlook, be aware that the new Outlook desktop application can't open PST files[^]. There is no word yet as to whether this will be fixed before they forcibly replace the current Outlook application with the new one.

NB2: By mentioning PST files, you're probably going to attract a lot of "PST recovery tools" spammers. They seem to love this site for some reason! :)

1 solution

To save mailitem as a *.pst file, use this: MailItem.SaveAs method (Outlook) | Microsoft Learn[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900