Modify and delete outlook tasks

L

landro

Hello,
using excel VBA I send task planning to my colleagues.
Sometimes I need to update the task or to delete it but i'm not able.
My code lines are:
-----
Sub DeleteTaxDayShared()
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("(e-mail address removed)")
myRecipient.Resolve
If myRecipient.Resolved Then
Set objTaskFolder =
objNS.GetSharedDefaultFolder(myRecipient,olFolderTasks)
Set colTask = objTaskFolder.Items
strFind = "[Subject] = " & Chr(34) & "Tax Day" & 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
-----
I receive runtime error on:
Set objTaskFolder = objNS.GetSharedDefaultFolder(myRecipient,
olFolderTasks)

Thanks.
 
K

Ken Slovak - [MVP - Outlook]

Do you have permissions to open that Tasks folder? Can you do it using the
UI?
 
L

landro

I don't know.
I don't know Outlook very well, I'm an excel user.
I supposed to have the permission due to the fact that I sent the taks
to colleagues.
the runtime error is -71286782 (fbc04002) that I'm not able to
address.
If the way I choose is wrong, please give me a suggestion.
I'm able to delete or postpone appointment, why I couldn't do the same
with tasks?
 
K

Ken Slovak - [MVP - Outlook]

You need to find out what permissions you have on that other mailbox, I
can't do that for you. The owner of the mailbox needs to look at the
delegate permissions that are installed, or your Exchange admins need to do
that.
 

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