problem in adding value to custom field in inbox

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

Guest

I had a problem in adding value to a custom field created in outlook2003. I
can able to create a custom field in outlook inbox, but i'm not able to add
value to it. To my knowledge the code seems to be fine and the value is
assigned to the custom field but something is blocking to display it.
Herewith i've pasted my code for your reference.

Dim olNamespace As Outlook.NameSpace
Dim cf As Outlook.MAPIFolder
Set olNamespace = Outlook.Application.GetNamespace("MAPI")
Set cf = olNamespace.GetDefaultFolder(olFolderInbox)
Dim emailitem As Outlook.MailItem

For Each emailitem In cf.Items
Dim prop As Outlook.UserProperty
Set prop = emailitem.UserProperties.Add("HowOld", olText, False,
Nothing)
prop.Value = DateDiff("d", emailitem.ReceivedTime, Now) & " days."
emailitem.Save
set prop = nothing
Next

Note: I'm using vb 6.0
 
Where do you want to field to display? Did you add the field with the folder's Field Chooser?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top