Why doesn't this work??? 
Author Message
 Why doesn't this work???

I want to permenantly delete a message.  The message object is oMessage.
Here is my code:

oMessage.Subject = "*Delete Me!!!*"
oMessage.Save()
oMessage.Delete()

oDeletedFolder = oSpace.GetDefaultFolder( 3 )  && Deleted Items
 m.cSearch = '[Subject] = "*Delete Me!!!*"'
oDeletedItem = m.oDeletedFolder.Items.Find(m.cSearch)

&& Message is found in the above line!!!!

oDeletedItem.Delete()

&& Message does NOT delete!!!!  Why????



Sun, 31 Oct 2004 22:28:17 GMT  
 Why doesn't this work???
Dereference (set to Nothing) both oDeletedItem and oMessage as soon as you are
done with them.

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


Quote:
> I want to permenantly delete a message.  The message object is oMessage.
> Here is my code:

> oMessage.Subject = "*Delete Me!!!*"
> oMessage.Save()
> oMessage.Delete()

> oDeletedFolder = oSpace.GetDefaultFolder( 3 )  && Deleted Items
>  m.cSearch = '[Subject] = "*Delete Me!!!*"'
> oDeletedItem = m.oDeletedFolder.Items.Find(m.cSearch)

> && Message is found in the above line!!!!

> oDeletedItem.Delete()

> && Message does NOT delete!!!!  Why????



Mon, 01 Nov 2004 00:51:45 GMT  
 Why doesn't this work???
Thanks....but it didn't change a thing. The message is still in the Deleted
Folder.

Any other ideas???


Quote:
> Dereference (set to Nothing) both oDeletedItem and oMessage as soon as you
are
> done with them.

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



> > I want to permenantly delete a message.  The message object is oMessage.
> > Here is my code:

> > oMessage.Subject = "*Delete Me!!!*"
> > oMessage.Save()
> > oMessage.Delete()

> > oDeletedFolder = oSpace.GetDefaultFolder( 3 )  && Deleted Items
> >  m.cSearch = '[Subject] = "*Delete Me!!!*"'
> > oDeletedItem = m.oDeletedFolder.Items.Find(m.cSearch)

> > && Message is found in the above line!!!!

> > oDeletedItem.Delete()

> > && Message does NOT delete!!!!  Why????



Mon, 01 Nov 2004 05:39:32 GMT  
 Why doesn't this work???
The following code worked just fine for me. Uncomment the message boxes to see
how the messages moves from the Drafts folder to the Deleted Items folder, then
gets permanently deleted.

set oMessage = Application.CreateItem(0)
oMessage.Subject = "*Delete Me!!!*"
oMessage.Save
'MsgBox 1
oMessage.Delete
'MsgBox 2

set oDeletedFolder = Application.Session.GetDefaultFolder( 3 )
cSearch = "[Subject] = '*Delete Me!!!*'"
set oDeletedItem = oDeletedFolder.Items.Find(cSearch)
'MsgBox oDeletedItem.Subject
oDeletedItem.Delete
'MsgBox 3

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


Quote:
> Thanks....but it didn't change a thing. The message is still in the Deleted
> Folder.

> Any other ideas???



> > Dereference (set to Nothing) both oDeletedItem and oMessage as soon as you
> are
> > done with them.

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



> > > I want to permenantly delete a message.  The message object is oMessage.
> > > Here is my code:

> > > oMessage.Subject = "*Delete Me!!!*"
> > > oMessage.Save()
> > > oMessage.Delete()

> > > oDeletedFolder = oSpace.GetDefaultFolder( 3 )  && Deleted Items
> > >  m.cSearch = '[Subject] = "*Delete Me!!!*"'
> > > oDeletedItem = m.oDeletedFolder.Items.Find(m.cSearch)

> > > && Message is found in the above line!!!!

> > > oDeletedItem.Delete()

> > > && Message does NOT delete!!!!  Why????



Tue, 02 Nov 2004 00:46:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Why oh why doesn't this work?

2. Why doesn't this work?

3. Why doesn't this work?!!

4. Why doesn't this work?

5. why doesn't it work?????

6. Why doesn't this work?

7. Why doesn't this work anymore?

8. threading and why doesn't it work!!!! :)

9. Itemop.Navigate - Why doesn't it work?!

10. Why doesn't this work

11. Why doesn't it work?

12. Help needed !! Why doesn't this work

 

 
Powered by phpBB® Forum Software