D
DavidB
Hello,
I am trying to permanently remove email item.
It works fine on my private POP3 mail using outlook2003.
On the work mail, outlook2003 connected to exchange server (connect mode or OffLine mode) it does not work and it fails on the attempt to get the Item using the GetItemFromId function with error 8004010F. See below the code.
Any idea why?
Or other way to remove an item?
thanks
David
---------------------------------------------
Sub DeleteDelete()
Dim myOlApp, myNameSpace, Sel, objRecip, MyItem As Object
Dim SavedEntryId, I
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set Sel = Application.ActiveExplorer.Selection
For I = 1 To Sel.Count
If Sel.Item(I).Class = olMail Then
Set MyItem = Sel.Item(I)
SavedEntryId = MyItem.EntryID
MyItem.Delete
Set MyItem = myNameSpace.GetItemFromID(SavedEntryId) ' <--- Run time error 8004010F, operation failed
MyItem.Delete
End If
Next
End Sub
I am trying to permanently remove email item.
It works fine on my private POP3 mail using outlook2003.
On the work mail, outlook2003 connected to exchange server (connect mode or OffLine mode) it does not work and it fails on the attempt to get the Item using the GetItemFromId function with error 8004010F. See below the code.
Any idea why?
Or other way to remove an item?
thanks
David
---------------------------------------------
Sub DeleteDelete()
Dim myOlApp, myNameSpace, Sel, objRecip, MyItem As Object
Dim SavedEntryId, I
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set Sel = Application.ActiveExplorer.Selection
For I = 1 To Sel.Count
If Sel.Item(I).Class = olMail Then
Set MyItem = Sel.Item(I)
SavedEntryId = MyItem.EntryID
MyItem.Delete
Set MyItem = myNameSpace.GetItemFromID(SavedEntryId) ' <--- Run time error 8004010F, operation failed
MyItem.Delete
End If
Next
End Sub