Outlook - Set value for a Field

L

lorenmcguire

I need to set a user defined variable that will stay in the form once it is
saved to the Calendar. This is using VBScript to set and use variables. I
appear to be able to retrieve the variable, but don't understand how it is
being set. I need to set the variable within the program so I can set a
value of another field to a combination of those variables.

As an example:
tmpCity = Item.UserProperties.Find("txtCity").Value

txtCity is in the field and format of the "Value" page on the Control.
The "Name" of the Control would Be "TextCityControl" on the "Display" page
of the Control.
This is a "user-defined field" within the Item.
I can get the "Value" of the item variable, but how can I set it?
Reading through the book in a variety fo areas, both the Outlook 2003 Inside
and Out and Programming Outlook and Exchange Second Edition is not helping!!

Thanks
 
W

Wolfram Jahn

lorenmcguire said:
I need to set a user defined variable that will stay in the form once it is
saved to the Calendar. This is using VBScript to set and use variables. I
appear to be able to retrieve the variable, but don't understand how it is
being set. I need to set the variable within the program so I can set a
value of another field to a combination of those variables.

As an example:
tmpCity = Item.UserProperties.Find("txtCity").Value

txtCity is in the field and format of the "Value" page on the Control.
The "Name" of the Control would Be "TextCityControl" on the "Display" page
of the Control.
This is a "user-defined field" within the Item.
I can get the "Value" of the item variable, but how can I set it?
Reading through the book in a variety fo areas, both the Outlook 2003 Inside
and Out and Programming Outlook and Exchange Second Edition is not helping!!

Thanks

We use:

Item.UserProperties.Find("txtCity").Value = myValue


Wolfram
 
L

lorenmcguire

Wolfram Jahn said:
We use:

Item.UserProperties.Find("txtCity").Value = myValue


Wolfram

Every time I try something like this, I get an error stating:

"Object required: 'Item.UserProperties.Find(...)'
Line No:161 - which is where I put this line

I did define the variable MyValue above as

MyValue = "This is a test"

I then spend a couple minutes clicking no to debug and OK on the message
pop-up because I can't get the error checker to work right.

I think I'm missing something really simple here.....

Thanks,
 
L

lorenmcguire

This appears to set the value and the msgbox will display this value. The
problem I run into is when the form is saved to the calendar, the value is
lost. I need to have this value put into the value for a user defined field.
the "txtCity" is the Property of the Control, whereas the TxtCityValue is
the user-defined field in this item and I need to set the Value for this
user-defined field. I just don't get how to set this value. If I don't set
this value, it is blanked when the user opens the calendar entry form after
it has been saved.

Thanks
 
W

Wolfram Jahn

Hi,

I forgot, if you use Outlook beyond version 2000, then you have to use

Item.UserProperties("txtCity").Value = myValue

instead. These access methods are not compatible, so we had to
encapsulate each field access with a procedure (set) and a function
(get)... :-(

Wolfram
 

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