Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   problem in adding value to custom field in inbox (http://www.outlookbanter.com/outlook-vba/16099-problem-adding-value-custom-field.html)

Zoom May 28th 06 08:51 AM

problem in adding value to custom field in inbox
 
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

Sue Mosher [MVP-Outlook] May 28th 06 01:40 PM

problem in adding value to custom field in inbox
 
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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Zoom" wrote in message ...
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



All times are GMT +1. The time now is 06:37 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com