
How to Create Task Item in Someone Else's Task Folder
Dmitry:
Thanks for the input. I feel I am almost there.
I created the following module. It creates the task; however, it still
insists on creating the task in the default folder rather than the folder of
the named recipient. What am I doing wrong?
Sub CallLog()
Dim ol As Outlook.Application
Dim olns As Outlook.NameSpace
Dim oSharedFolderOwner As Outlook.Recipient
Dim oFolder As Outlook.MAPIFolder
Dim MyTaskItem As TaskItem
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set oSharedFolderOwner = olns.CreateRecipient("Hyatt, Mike")
Set oFolder = olns.GetSharedDefaultFolder(oSharedFolderOwner,
olFolderContacts)
Set MyTaskItem = oFolder.Items.Add(olTaskItem)
With MyTaskItem
.Subject = " "
.Body = "Call received on " & Date & " at [time]." & Chr(13) &
Chr(13) & _
"[Message]"
.Display
End With
AppActivate (" - Task")
Set ol = Nothing
Set olns = Nothing
Set oSharedFolderOwner = Nothing
Set oFolder = Nothing
Set MyTaskItem = Nothing
End Sub
Quote:
> Use Namespace.GetSharedDefaultFolder(Recipient, olFolderTask), then
> MAPIFolder.Items.Add to create a task
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
> > I have a small program that automatically creates a task. However, I
> > designed this for my assistant. This needs to create a task in a folder
> > other than her default folder. (She has access to my folder and I want
the
> > task to be created in that folder.)
> > What do I need to midify to do this?
> > Thanks.
> > P.S. Here's the program I am using.
> > Sub CallLog()
> > Set MyTaskItem = Application.CreateItem(olTaskItem)
> > With MyTaskItem
> > .Subject = " "
> > .Body = "Call received on " & Date & " at [time]." & Chr(13) &
> > Chr(13) & _
> > "[Message]"
> > .Display
> > End With
> > AppActivate (" - Task")
> > Set MyTaskItem = Nothing
> > End Sub