creating and setting userproperties programmatically

  • Thread starter Thread starter Preston
  • Start date Start date
P

Preston

Hi,
I was wondering if someone here might be able to give a hand to something
I am trying to accomplish. I am trying to write logic to go into an email in
a given folder (resume folder) in my inbox and parse out the applicants name
based on the body contents of the email. I have been able to get the name out
without too much trouble and now want to be able to create a userproperty for
each mailitem parsed and set that property to the name of the applicant.
Ultimately, this will allow me to see the applicants name in the fields
columns. Here is what I have tried.

'map object to subfolder i want and for each mailitem, get and set the
userproperty
'i have left out the string parsing logic and put the string in strName
'e.g.

For each message in mySubFld.items
message.userproperties.add "ApplicantName", olText
message.userproperties("ApplicantName") = strName
next message

'i have also tried the following:
for each message in mySubFld.Items
set myProp = message.userproperties.add("ApplicantName", olText)
myProp.value = strname
next message

neither of these give me any errors but they just don't work. i go back and
run this:
for each message in mySubFld.Items
debug.print message.userproperties.count
next

and get all 0's ?? i'm not sure what's going on here but for some reason
these user properties aren't persistent. They just go away? I get a new field
in the "user-defined fields for this folder" list to add to my columns but it
isn't populated with anything.
Thank you for any help that you can give :)
Preston
 
!!!

i think i got it

*******************************************
message.save
*******************************************
:-D

i didn't know that programmatic changes had to be saved though. Any senior
developers please help me understand this. thank you again
 
What's to understand? In any code if you don't save a change it won't
persist.
 
i guess it makes more sense if i consider it in light of the mailitem being
an object. i was thinking along the lines of defining variables and such.
strSweet = "sweet" or even DELETE * FROM tblWasMyLoot;
those are the types of changes that I was thinking of.
thank you for the response :)
 
Back
Top