BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Deleting an item in Outlook

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Jason Smart
Guest





PostPosted: Tue Dec 09, 2003 4:28 am    Post subject: Deleting an item in Outlook Reply with quote



Hi

I delete an item (EXCEPT a ContactItem) from Outlook from within Outlook
itself (by pressing the DELETE key). The item gets placed into the
'Deleted Items' folder.

For all items so far (except ContactItem) it appears that the EntryID
for this item remains the same. Therefore if I go to reference the item
based on it's EntryID from my program, it happily does what I want to
do, on the deleted item. A ContactItem raises an exception which is
what I expected to happen for all other items.

Why is this?

I do something along the lines of:
...MapiNamespace.GetItemFromID(EntryID, StoreID) as _TaskItem
where _TaskItem is an interface to a TaskItem.

when I execute this code for a ContactItem, it raises an EoleException.
Other items return the item sitting in the Deleted Items. If I remove
the item out of deleted items (ie, permanently delete) it raises the
error fine.

So is there a better way to get access to my item then by calling
GetItemFromID, or once I have my item, can I find out if it came from
the Deleted Items folder or not?

Many thanks

Jason
--
remove .--- to respond via email

Back to top
Dmitry Streblechenko
Guest





PostPosted: Tue Dec 09, 2003 6:48 am    Post subject: Re: Deleting an item in Outlook Reply with quote



Normally the entry id does change when an item is moved to a different
folder, it is just a peculiarity of the PST provider that it stays the same.
You can check the MailItem.Parent property to see whether it is the Deleted
Items folder or not. Or you can delete the message twice: call
MailItem.Delete, dereference it, then try to open if again using
GetItemFromID. If it opens fine and the parent is Deleted Items, call Delete
again - this time it will be gone for good.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Jason Smart" <jason (AT) ditsu (DOT) com.---> wrote

Quote:
Hi

I delete an item (EXCEPT a ContactItem) from Outlook from within Outlook
itself (by pressing the DELETE key). The item gets placed into the
'Deleted Items' folder.

For all items so far (except ContactItem) it appears that the EntryID
for this item remains the same. Therefore if I go to reference the item
based on it's EntryID from my program, it happily does what I want to
do, on the deleted item. A ContactItem raises an exception which is
what I expected to happen for all other items.

Why is this?

I do something along the lines of:
...MapiNamespace.GetItemFromID(EntryID, StoreID) as _TaskItem
where _TaskItem is an interface to a TaskItem.

when I execute this code for a ContactItem, it raises an EoleException.
Other items return the item sitting in the Deleted Items. If I remove
the item out of deleted items (ie, permanently delete) it raises the
error fine.

So is there a better way to get access to my item then by calling
GetItemFromID, or once I have my item, can I find out if it came from
the Deleted Items folder or not?

Many thanks

Jason
--
remove .--- to respond via email




Back to top
Jason Smart
Guest





PostPosted: Tue Dec 09, 2003 10:29 pm    Post subject: Re: Deleting an item in Outlook Reply with quote



Hi

Thanks for that. I shall read the .Parent property. I'm not actually
deleting the items from my program in the first place.

Cheers and merry Xmas

Jason

Dmitry Streblechenko wrote:

Quote:
Normally the entry id does change when an item is moved to a different
folder, it is just a peculiarity of the PST provider that it stays the same.
You can check the MailItem.Parent property to see whether it is the Deleted
Items folder or not. Or you can delete the message twice: call
MailItem.Delete, dereference it, then try to open if again using
GetItemFromID. If it opens fine and the parent is Deleted Items, call Delete
again - this time it will be gone for good.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


--
remove .--- to respond via email


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.