Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook UserProperties not readable

Status
Not open for further replies.

timfoster

Programmer
Dec 19, 2002
110
GB
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
 
Not sure what Item is... I would expect the below to return results.

Code:
Debug.Print curItem.UserProperties(x).Name & ": " & curItem.UserProperties(x).Value
... assuming your user field is notes...
Code:
Debug.Print "Notes: " & curItem.UserProperties("notes").Value
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top