R
Rahul
Hi,
I am using Outlook 2003 and have designed and coded an Outlook custom form.
When a requestor submits the form, the copy in sent folders should be
deleted permanently. I am able to delete based on the Subject line except the
latest/current form which was submitted. So there is always one copy of the
form in Requestor's sent items. Please help me delete even the current form
from Sent items by modifying the below code since only this style of coding
works in my Outlook.
Function deleteItem()
Const olFolderSentMail = 5
Const olFolderDeletedItems = 3
strUniqueSubject = "ABCD Form"
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderSentMail)
Set colItems = objFolder.Items
For each objItem in colItems
If objItem.Subject = strUniqueSubject Then
msgbox "SentItems: "&objItem.Subject
objItem.delete
End if
Next
Set objFolder = objNamespace.GetDefaultFolder(olFolderDeletedItems)
Set colItems = objFolder.Items
For each objItem in colItems
If objItem.Subject = strUniqueSubject Then
msgbox "Delete Items"
objItem.delete
End if
Next
End Function
Thanks,
Rahul...
I am using Outlook 2003 and have designed and coded an Outlook custom form.
When a requestor submits the form, the copy in sent folders should be
deleted permanently. I am able to delete based on the Subject line except the
latest/current form which was submitted. So there is always one copy of the
form in Requestor's sent items. Please help me delete even the current form
from Sent items by modifying the below code since only this style of coding
works in my Outlook.
Function deleteItem()
Const olFolderSentMail = 5
Const olFolderDeletedItems = 3
strUniqueSubject = "ABCD Form"
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderSentMail)
Set colItems = objFolder.Items
For each objItem in colItems
If objItem.Subject = strUniqueSubject Then
msgbox "SentItems: "&objItem.Subject
objItem.delete
End if
Next
Set objFolder = objNamespace.GetDefaultFolder(olFolderDeletedItems)
Set colItems = objFolder.Items
For each objItem in colItems
If objItem.Subject = strUniqueSubject Then
msgbox "Delete Items"
objItem.delete
End if
Next
End Function
Thanks,
Rahul...