problem in adding value to custom field in inbox

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
 
S

Sue Mosher [MVP-Outlook]

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
 

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

Top