Deleting a message item permanently

B

Bilal

When "item.delete" vbscript is given, the item is moved to 'deleted items'
folder. How can the item be deleted permanently? Any help is very much
appreciated.
 
B

Bilal

Thank you Sue Mosher for you reply.

In fact, the form we have developed is to get the approval from department
managers. It has an 'approve' and a 'deny' button. once clicked on on of
these buttons a new reply mail is sent and the custom from is deleted from
inbox using 'item.delete'. we want to ensure that the users should completely
not have access to this item, once approval is given. When it is in deleted
items, still it is possible to open and click the approval button again.

Is there any work around you can suggest.

Thank you
Bilal
 
D

Dmitry Streblechenko

Stamp it with your own custom property, find it in the Deleted Items folder,
then delete it again.

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

Sue Mosher [MVP-Outlook]

Put code in your CustomAction event handler to check the parent folder, and
if it's in the Deleted Items folder, cancel the action and show a MsgBox to
the user.
 
B

Bilal

thanks dmitry. I appreicate if you could guide how to set the customer
property, find and delete using vbscript.

bilal
 
D

Dmitry Streblechenko

Even a custom subject would do

strUniqueSubject = "MsgToBeDeletedRightNow"
set Msg = Application.ActiveExplorer.Selection(1)
Msg.Subject = strUniqueSubject
Msg.Save
set Dumpster = Application.Session.GetDefaultFolder(olFolderDeletedItems)
set Msg = Dumpster.Items.Find("[Subject] = '" & strUniqueSubject & "'")
if not (Msg Is Nothing) Then
Msg.Delete
End If


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

Dmitry Streblechenko

Sorry, missed a call to MailItem.Delete:

strUniqueSubject = "MsgToBeDeletedRightNow"
set Msg = Application.ActiveExplorer.Selection(1)
Msg.Subject = strUniqueSubject
Msg.Save
Msg.Delete
set Dumpster = Application.Session.GetDefaultFolder(olFolderDeletedItems)
set Msg = Dumpster.Items.Find("[Subject] = '" & strUniqueSubject & "'")
if not (Msg Is Nothing) Then
Msg.Delete
End If

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Dmitry Streblechenko said:
Even a custom subject would do

strUniqueSubject = "MsgToBeDeletedRightNow"
set Msg = Application.ActiveExplorer.Selection(1)
Msg.Subject = strUniqueSubject
Msg.Save
set Dumpster = Application.Session.GetDefaultFolder(olFolderDeletedItems)
set Msg = Dumpster.Items.Find("[Subject] = '" & strUniqueSubject & "'")
if not (Msg Is Nothing) Then
Msg.Delete
End If


--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Bilal said:
thanks dmitry. I appreicate if you could guide how to set the customer
property, find and delete using vbscript.

bilal
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top