Free Support Forum - aspose.com

OLM to PST

Hello,

i have an OLM file that was generated from Office Mac. I want to convert it to PST.

I tried using a code i found available online but didn’t work.

Does any one have a code that could do that? Unfortunately, my coding skills are quite limited.

Thank you in advance!

@apn3agr,

I have observed your requirements and suggest you to please try using following sample code on your end. I also suggest you to please visit this documentation link for your kind reference as well.

OlmStorage storage = new OlmStorage(Program.OLMFile);

PersonalStorage ToPST = PersonalStorage.Create(Program.ToPST, FileFormatVersion.Unicode);

foreach (OlmFolder folder in storage.FolderHierarchy)
                {
				
				foreach (MapiMessage msg in Gstorage.EnumerateMessages(folder))
				{
				
				FolderInfo myFolder=null;
					
				myFolder=ToPST.RootFolder.AddSubFolder("Inbox");
				if(myFolder==null)
					myFolder=ToPST.RootFolder.AddSubFolder("Inbox");
					
					myFolder.AddMessage(msg);

					}				
				}
				
ToPST.Dispose();

storage.Dispose();

unfortunately it doesn’t work

i do manage to create a pst file but its only 265kb. My OLM file is 13.8Gb, so this means no conversion is made.

I opened the OLM file with a 3rd party software and saw that it has a “Local” account(with it’s own list of folders, all of them empty) and then my email account (with all folders/data that i need to extract).

It seems like your code stops at the first account and does not continue to the second. Same happens if i run the sample codes for opening the OLM file through ASPOSE Email.

How can i make it read the second account? Also i want to preserve all of its folders/structure to the new generated PST, not just the inbox.

@apn3agr,

I have observed the information shared and like to share that Aspose.Email provides basic support for loading OLM file and I don’t think there is any account related compulsion while parsing OLM and adding to PST. What I suggest you is to try reading the OLM file only and see if API is able to read the entire content of it or no. You can also try this sample to get count of items inside folder. This sample will help you print all folder paths in your OLM. This way, you will be able to recognize if API is able to display every thing inside your OLM or not. If there is any thing missing then we will require access to OLM file to carryout further investigation. However, if API is able to list every thing using mentioned codes but moving them to PST is an issue then we will further work over it.

@mudassir.fayyaz

I did both the count and the reading. It only sees the “Local” account, not my email account.

when i try to read the contents of the OLM file it returns

Subject: NEW USER (this is from the “Local” account")

Subfolder: xxx@xxx.xxx (this is my email account, where i want to pull the data from)

So, it seems that Aspose.Email is not able to read the entire content. It stops at the first account and its subfolders. To be honest, i don’t even know what this Local account is; i guess Outlook for Mac has it as a default and it got extracted when i created that OLM file.

@apn3agr,

I have observed your comments and like to share that there is no option to set for accounts while reading from OLM. In your case, I request you to please share the source file so that we may investigate the issue further on our end to help you out.

@mudassir.fayyaz

unfortunately i cannot share the OLM file; it contains sensitive information, plus it is 13Gb

What i can provide is the folder structure based on the 3rd party software i downloaded

Would this help?

@apn3agr,

Actually, we need to have the source file that is actually reproducing the scenario on your end and that we may try to reproduce and resolve on our end. You may consider sharing a sample OLM with desired account based implementation and which is reproducing issue on your end too. We will log and resolve that in our issue tracking system.

@mudassir.fayyaz

Problem is that I don’t have a Mac anymore. If you have a Mac and export a standard exchange account, you should get the same exact structure.

I wish I could provide you with the source file but that’s not possible.

Happy to try more coding alternatives if you have anything in mind

Thank your for all your help

@apn3agr,

We can understand your concern and limitations. But from our perspective, we need a sample file that is failing on your end and that we may test and on the basis of that resolve the issue. Therefore, in order to add request in our issue tracking system, I request you to please provide the source file (dummy one but which is reproducing issue) and we may add that in our issue tracking system. Otherwise, from API perspective there is no configurations or settings required to read OLM.

@mudassir.fayyaz

would the below structure work to help you assist me with my issue? i got it using “GetFolderPathInOLM.cs” where xxx@xxx.com is the account i am trying to extract all emails. Items without Accounts\ path are empty.

Address Book\

Accounts\

Accounts\xxx@xxx.xxx\

Accounts\xxx@xxx.xxx\Contacts\

Accounts\xxx@xxx.xxx\United States holidays\

Accounts\xxx@xxx.xxx\Calendar\

Accounts\xxx@xxx.xxx\Birthdays\

Accounts\xxx@xxx.xxx\Tasks\

Accounts\xxx@xxx.xxx\Tasks?? Groceries\

Accounts\xxx@xxx.xxx\Tasks\Untitled list\

Accounts\xxx@xxx.xxx\Tasks\To do\

Accounts\xxx@xxx.xxx\Notes\

Accounts\xxx@xxx.xxx\Sync Issues\

Accounts\xxx@xxx.xxx\Sync Issues\Server Failures\

Accounts\xxx@xxx.xxx\Sync Issues\Local Failures\

Accounts\xxx@xxx.xxx\Sync Issues\Conflicts\

Accounts\xxx@xxx.xxx\Sent Items\

Accounts\xxx@xxx.xxx\Scheduled\

Accounts\xxx@xxx.xxx\RSS Subscriptions\

Accounts\xxx@xxx.xxx\Junk Email\

Accounts\xxx@xxx.xxx\Inbox\

Accounts\xxx@xxx.xxx\Inbox\BD\

Accounts\xxx@xxx.xxx\Drafts\

Accounts\xxx@xxx.xxx\Deleted Items\

Accounts\xxx@xxx.xxx\Conversation History\

Accounts\xxx@xxx.xxx\Clutter\

Accounts\xxx@xxx.xxx\Boomerang\

Accounts\xxx@xxx.xxx\Archive\

Calendar\

Tasks\

Notes\

Spam Email\

Sent Items\

Outbox\

Inbox\

Drafts\

Deleted Items\

@apn3agr,

I regret to share that we need the actual file that is creating issue on your end and that we may use on our end to reproduce the issue. We really wish to help you but need your cooperation in this regard.