Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why is this soooo slow?

Status
Not open for further replies.

dotolee

Technical User
Jan 27, 2008
134
CA
Hi there.
I have written some code that takes date fields and tries to create an outlook task out of them. It works fine when you initially run the code, but if a task already exists and you just want to update it, the DeleteOutlookTask method is failing with an error:
Error -2147221233 The operation failed.
The error is happening on the line
"Set objItem = objNS.GetItemFromID(strEntryID)"
I've double checked the outlookentryid to ensure that what I save in the database when the task is created is exactly the same value that I pass to this routine.

Any help would be appreciated.

Public Sub DeleteOutlookTask(strEntryID As String)
On Error GoTo DeleteOutlookTask_Err
Dim objOL, objNS, objItem
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Debug.Print "delete outlook: " & strEntryID
Set objItem = objNS.GetItemFromID(strEntryID)
If Not objItem Is Nothing Then
objItem.Delete
Else
MsgBox ("Original item not found")
End If
Exit Sub
DeleteOutlookTask_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
End Sub
 
oops. the heading for this post was wrong. I was going to ask a question about speed initially but resolved that issue on my own.
thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top