Outlook 2003: Personalized form with VB-Script and VB.NET

O

Oskar Vaia

Hi,

in my own personalized task-form i have amongst others some VB-Script-code
for the "Item_CustomPropertyChange"-event.
This event will triggered when i insert or change values on my custom-fields
on the personalized task-form and this is right.

An application, which i have developed with VB.NET 2005 inserts or changes
values on the custom-fields on the personalized task-form, too.

Here the VB.NET-code:
---
Dim myOlApp As New Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myitem As Outlook.TaskItem
myNamespace = myOlApp.GetNamespace("MAPI")
myitem = myNamespace.GetItemFromID(strEntryID, objStoreID)
myitem.UserProperties("MB1").Value = True
myitem.Save()
myNamespace = Nothing
myOlApp = Nothing
---

Now my question:
When my VB.NET-application inserts or changes values on the custom-fields on
the personalized task-form, then the VB-Script code behind the taskform will
triggered, too. It is possible to prevent this comportment?
The VB-Script code behind the taskform should only triggered when i insert
or change values on my taskform directly.

thx & bye

Oskar
 
S

Sue Mosher [MVP-Outlook]

Would the user normally be able to change MB1 manually? Does the VBScript code need to handle any changes in MB1?
 
O

Oskar Vaia

Hi Sue,

yes, the user normally would be able to change MB1 manually and the VBScript
code needs to handle any changes in MB1, too.

thx and bye

Oskar


Would the user normally be able to change MB1 manually? Does the VBScript
code need to handle any changes in MB1?
 
S

Sue Mosher [MVP-Outlook]

In that scenario, what you could do is set another property value on the form (BillingInformation or Mileage or a custom property) and allow the script to run only when that property is not a certain value. Like this:

1) Add-in sets "check" property value to "stop" value. [could be text, Boolean, numeric, depending on what property you use]
2) Add-in changes MB1.
3) CustomPropertyChange event fires, looks at value of "check" property, and runs no more code for MB1.
4) Add-in sets "check" property to "go" value.

Thus the CustomPropertyChange event would still fire, of course -- you can't prevent that -- but the script code would run only on the "go" value.
 
O

Oskar Vaia

Hi Sue,

many thx for the tip. I have resolved the problem in similar way.
I set a global variable in the item_open event. This event only fires if i
open the task in outlook and not when i sets values on the task across the
Add-In.

bye

Oskar
 

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