Free Support Forum - aspose.com

How to Detect Duplicates in Office 365 and Skip or overwrite duplicate emails

Hi,

We are migrating PST to Office 365 account. but in between process breaks down. A few emails have been already uploaded to my Office 365 account. Is there any way to skip or overwrite those emails when start migration again.

in short, I am talking about incremental migration

Kind regards,
Manoj

@ManojDwivedi,

There is no such option available to do incremental migration at the moment. However, you can use the RestoreOptions.RemoveNonexistentItems to remove the non-existent items from the mailbox.

Could you please let me know how to use RestoreOptions and RemoveNonexistentItems

@ManojDwivedi,

Please have a look at the following code sample and let us know if you need further assistance in this regard.

Sample Code

const string mailboxUri = "https://exchange.domain.com/ews/Exchange.asmx";
const string domain = @"";
const string username = @"userName";
const string password = @"password";
NetworkCredential credentials = new NetworkCredential(username, password, domain);
IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
string inputPst = @"Source.pst";
PersonalStorage pst = PersonalStorage.FromFile(inputPst);
var settings = new Aspose.Email.Clients.Exchange.WebService.RestoreSettings();
settings.Options = RestoreOptions.RemoveNonexistentItems;
            
client.Restore(pst,settings);