Exchange Inbox backup into PST

Hi,


I have account on exchange and want to take backup of my exchange Inbox folder into some PST. I need this backup for offline processing…

does aspose provide any feature to take this backup.


Hi Cornelius,

Thanks for writing to Aspose.Email support team.

I have checked the documentation and afraid to inform that there is no such feature available which directly takes backup of exchange folders into PST.

However you may perform this task using following sample code which reads all the messages from the inbox of an account on exchange and stores them in a newly created PST.

var pst = PersonalStorage.Create(“C:\temp\backup.pst”, FileFormatVersion.Unicode);
pst.RootFolder.AddSubFolder(“Inbox”);
var inbox = pst.RootFolder.GetSubFolder(“Inbox”);
var credentials = new NetworkCredential(“username”, “123456”);
var client = new ExchangeWebServiceClient(“https:[//exchange.aspose.com/ews/Exchange.asmx](https://exchange.aspose.com/ews/Exchange.asmx)”, credentials);
var mbInfo = client.GetMailboxInfo();
var messageInfos = client.ListMessages(mbInfo.InboxUri, 10);
foreach (var messageInfo in messageInfos)
{
var message = client.FetchMessage(messageInfo.UniqueUri);
var mapiMessage = MapiMessage.FromMailMessage(message);
inbox.AddMessage(mapiMessage);
}

Please feel free to write us if you have any other query in this regard.