
Adding tasks to a named task list
This bit is a little more complex, I use the
GetSharedDefaultFolder method to retrieve the mailbox's
default task folder.
Set oFolder = oMapi.GetSharedDefaultFolder
(oMailBoxObj, olFolderTasks)
Where oMailBoxObj is the resolved user mail store and
oFolderTasks is the inbuilt CONSTant for the folder type.
However I think you'll have to enumerate the folders
within the TaskList folder to find the one you're looking
for.
ie:
dim myFolder As Object
Set oFolder = oMapi.GetSharedDefaultFolder _
(oMailBoxObj,olFolderTasks)
for each myFolder in oFolder
If myFolder.Name = "Match name Here" Then
' Do Add Routine
with myFolder
end with
End If
Next myFolder
I think there may be another way via the
GetFolderFromID method in that your first posted example
can retrieve the folder directly:
Set myolapp = CreateObject("Outlook.Application")
Set myNameSpace = myolapp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
myEntryID = myFolder.EntryID
myStoreID = myFolder.StoreID
Set myFolder = myNameSpace.GetFolderFromID(myEntryID,
myStoreID)
Quote:
>-----Original Message-----
>That,s great Dave, I can resolve it fine now, but where
did your oFolder
>object come from?
>Nigel
>> You need to resolve the mailbox first along the lines
of:-
>> Set oMailBoxOBJ = oMapi.CreateRecipient("Customer
>> Callback")
>> oMailBoxOBJ.Resolve
>> If oMailBoxOBJ.Resolved Then
>> ' next you need to get the folder you want to work
with
>> ' then add the items using the Items Add Method
>> With oFolder.Items.Add("MessageClass")
>> .Status = 0 ' Not Started
>> .Unread = True
>> .Save
>> End With
>> End If
>> >-----Original Message-----
>> >I can add a task to the logged in users task list
easily
>> enough. I can't
>> >seem to figure out how I add a task to a specific task
>> list in a specific
>> >folder though.
>> >Essentialy I have a mailbox called "Customer Callback"
>> containing a tasl
>> >list called "Customer Callbacks". I can get an object
>> reference to it using
>> >:
>> >oOutlook = createobject("Outlook.Application")
>> >oMapi = oOutlook.GetNameSpace("MAPI")
>> >oTaskList = oMapi.folders["Mailbox - Customer
>> Callback"].folders["Customer
>> >Callbacks"]
>> >But I just can't figure out how to add my task to it.
Any
>> tips would be very
>> >welcome.
>> >TIA
>> >Nigel
>> >.
>.