I hope all of you are doing good, staying safe & healthy, I have one question regarding outlook mails, can I move all the mails (mails that category is blank) from a outlook folder to another outlook folder at once like copy and paste not through loop, move bulk mails at once, is this possible? if yes? please help me.
Like if we do manually then will go to that folder then apply filter then select those filtered mails and drags those mails to another folder, at once we moved all the mails to difference folder.
How can we do this through Excel VBA?
Please help me to resolve this query.
Thanks Kashif
CodePudding user response:
The Outlook object model doesn't provide any method for moving items in bulk. The best what you could do is to apply a search criteria to find only items that should be moved and call the Move method to each of them programmatically in the loop. Read more about possible ways of filtering items in Outlook programmatically (searching):
- How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)
- How To: Use Restrict method to retrieve Outlook mail items from a folder
- Advanced search in Outlook programmatically: C#, VB.NET
CodePudding user response:
As Eugene mentioned, there is no way to do that in Outlook Object Model. If using Redemption is an option, you can call RDOFolder.Items.MoveMultiple and pass an array of entry ids as a parameter. The array of entry ids can be constructed by calling RDOFolder.Items.MAPITable.ExecSQL with the appropriate restriction (ExecSQL will return an instance of the ADODB.Recordset object).
