View Single Post
  #2  
Old October 4th 07, 02:39 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Delete Shared Task

This really shouldn't make any difference, but see if it does. Grab the
EntryID and StoreID of the task item and release your objTask reference,
then reinstantiate that or a new task object and see if you can then delete
it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Job" wrote in message
...
Trying to delete a shared task. Using this example:

Sub DeleteSharedTask()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim strFind As String
Dim objCalFolder As Outlook.MAPIFolder
Dim colCalendar As Outlook.Items
Dim objAppt As Outlook.TaskItem
Dim myRecipient As Outlook.recipient

Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set myRecipient = objNS.CreateRecipient("USER XYZ")
myRecipient.Resolve
If myRecipient.Resolved Then
Set objTaskFolder = objNS.GetSharedDefaultFolder(myRecipient,
olFolderTasks)
Set colTask = objTaskFolder.Items
strFind = "[Subject] = " & Chr(34) & "Test Delete" & Chr(34)
Set objTask = colTask.Find(strFind)
If Not objTask Is Nothing Then
objTask.Delete
End If
End If
Set objOL = Nothing
Set objNS = Nothing
Set objCalFolder = Nothing
Set colCalendar = Nothing
End Sub

Error on the objTask.Delete = The operation failed. An object could not be
found.

I can debug and display the item, change the item, look at all of the
itemproperties, but not delete. I have been granted ownership rights to
the user's shared tasks. Any suggestions?


Ads