Jon Channon
Posts: 1
Joined: 2006-11-15
|
For Outlook: Is it possible to search the deleted items folder for emails from a certain address and subject and then delete the emails it finds?
If so could you provide some sample code? Gratefully received!
Thanks
Jon |
|
Dmitry Kostochko
Add-in Express team
Posts: 2880
Joined: 2004-04-05
|
Hi Jon,
See the code below:
uses Outlook2000;
procedure TAddInModule.TAddInModule.adxOlExplorerCommandbar1Controls0Click(Sender: TObject);
var
i: Integer;
IFolder: MAPIFolder;
IMail: _MailItem;
Subject, SenderName: WideString;
begin
IFolder := OutlookApp.GetNamespace('MAPI').GetDefaultFolder(olFolderDeletedItems);
if Assigned(IFolder) then
try
for i := IFolder.Items.Count downto 1 do begin
IFolder.Items.Item(i).QueryInterface(IID__MailItem, IMail);
if Assigned(IMail) then
try
Subject := IMail.Subject;
SenderName := IMail.SenderName;
//TODO
//if (Subject = '') and (SenderName = '') then IMail.Delete;
finally
IMail := nil;
end;
end;
finally
IFolder := nil;
end;
end;
P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
|
|