Hello,
I want to move mails which contains predefined subject from Outlook inbox to my local Archive folder.
Anyone please help…
Hello,
I want to move mails which contains predefined subject from Outlook inbox to my local Archive folder.
Anyone please help…
Hello!
Try to filter the mails using the “Filter Property”
Refer to this:
Hope it Helps!
Regards,
Hi Abhilash,
Try Using this below
Main.xaml (7.0 KB)
Thanks for reply.
The links which you provide will move email within your outlook account but not moves to Archive folder or PST file.
try below code
using Outlook = Microsoft.Office.Interop.Outlook;
public void MoveMyEmails()
{
//set up variables
Outlook.Application oApp = null;
Outlook.MAPIFolder oSource = null;
Outlook.MAPIFolder oTarget = null;
try
{
//instantiate variables
oApp = new Outlook.Application();
oSource = oApp.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
oTarget = oApp.Session.Folders[“Archive”];
//loop through the folders items
for (int i = oSource.Items.Count; i > 0; i–)
{
move the item
oSource.Items[i].Move(oTarget);
}
}
catch (Exception e)
{
//handle exception
}
//release objects
if (oTarget != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(oTarget);
GC.WaitForPendingFinalizers();
GC.Collect();
}
if (oSource != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(oSource);
GC.WaitForPendingFinalizers();
GC.Collect();
}
if (oApp != null)
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(oApp);
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
Hello,
Thanks for reply @ronlobo
Please refer to attached workflow it’s working fine.
Move Emails.xaml (12.0 KB)