iterate through each field in a Task

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is what I've started with

Set ol = New Outlook.Application
Set olNs = ol.GetNamespace("MAPI")
Set myRecipient = olNs.CreateRecipient("PMO")
myRecipient.Resolve
If myRecipient.Resolved Then
Set Fldr = olNs.GetSharedDefaultFolder _
(myRecipient, olFolderTasks)
End If

For i = 1 To Fldr.Items.Count

'For Each fld In Fldr.Items(i).Subject
' Debug.Print "Field Name : " & fld.Name
' Debug.Print "Field Value : " & fld.Value & vbCrLf
'Next


Debug.Print Fldr.Items(i).Subject


For Each fld In Fldr.Items(i).UserProperties
Debug.Print "Field Name : " & fld.Name
Debug.Print "Field Value : " & fld.Value & vbCrLf
Next


Next i

End Sub

This gives me the subject of each task and the custom fields for each task
in a users shared task folder.

What I'm trying to do is iterate through each of the fields in the task so
that I don't have to specify each field. for example;

I don't want to do this
Fldr.Items(i).Subject
Fldr.Items(i).Duedate
Fldr.Items(i).Body
etc.

Anyone know the code to pull the field name and associated value for every
field of the task?

Cheers
 
Thanks Sue! that's all I needed...don't know why I couldn't find that before..

Thanks again.
 

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

Back
Top