I have a custom Outlook task form that allows me to manage work for a client. I use my own notes field as a UserProperty.
When I set the form up and create a new task the form displays correctly and I can add comments to my GPCNotes column. However, as soon as I close the form, I can no longer read the content of that UserProperty. Opening the form opens it with the standard tasks form again. If I add the column into a custom view on the tasks folder I can see the column and the text within it (or as much of the column as will fit in the screen). The field may contain many lines of notes though, so it's not possible to see everything.
I've tried running some code to force the message class to be my custom form, so MessageClass = "IPM.Task.GPCTask" but I still can't read the column. I've forced the default form for the folder to be my form, but still nothing. even running the code below returns no user props.
I'm totally stumped with this now. Any help would be greatly appreciated.
Dim f As Outlook.Folder, curItem As TaskItem
Set f = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
If f.Items.Count > 0 Then
Set itms = f.Items
NumItems = f.Items.Count
' Loop through all of the items in the folder
For i = 1 To NumItems
Set curItem = itms.Item(i)
Debug.Print curItem.Subject & ": (Custom Prop. Count " & curItem.UserProperties.Count & ")"
If curItem.UserProperties.Count > 0 Then
For x = 1 To curItem.UserProperties.Count
Debug.Print curItem.UserProperties.Item(x).Name & ": " & curItem.UserProperties.Item(x).Value
Next
End If
Next
End If
When I set the form up and create a new task the form displays correctly and I can add comments to my GPCNotes column. However, as soon as I close the form, I can no longer read the content of that UserProperty. Opening the form opens it with the standard tasks form again. If I add the column into a custom view on the tasks folder I can see the column and the text within it (or as much of the column as will fit in the screen). The field may contain many lines of notes though, so it's not possible to see everything.
I've tried running some code to force the message class to be my custom form, so MessageClass = "IPM.Task.GPCTask" but I still can't read the column. I've forced the default form for the folder to be my form, but still nothing. even running the code below returns no user props.
I'm totally stumped with this now. Any help would be greatly appreciated.
Dim f As Outlook.Folder, curItem As TaskItem
Set f = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
If f.Items.Count > 0 Then
Set itms = f.Items
NumItems = f.Items.Count
' Loop through all of the items in the folder
For i = 1 To NumItems
Set curItem = itms.Item(i)
Debug.Print curItem.Subject & ": (Custom Prop. Count " & curItem.UserProperties.Count & ")"
If curItem.UserProperties.Count > 0 Then
For x = 1 To curItem.UserProperties.Count
Debug.Print curItem.UserProperties.Item(x).Name & ": " & curItem.UserProperties.Item(x).Value
Next
End If
Next
End If