Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Forms (http://www.outlookbanter.com/outlook-using-forms/)
-   -   Outlook 2003: Personalized form with VB-Script and VB.NET (http://www.outlookbanter.com/outlook-using-forms/60110-outlook-2003-personalized-form-vb.html)

Oskar Vaia October 30th 07 09:10 AM

Outlook 2003: Personalized form with VB-Script and VB.NET
 
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


Sue Mosher [MVP-Outlook] October 30th 07 01:46 PM

Outlook 2003: Personalized form with VB-Script and VB.NET
 
Would the user normally be able to change MB1 manually? Does the VBScript code need to handle any changes in MB1?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


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


Oskar Vaia October 30th 07 06:12 PM

Outlook 2003: Personalized form with VB-Script and VB.NET
 
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


"Sue Mosher [MVP-Outlook]" schrieb im Newsbeitrag
...
Would the user normally be able to change MB1 manually? Does the VBScript
code need to handle any changes in MB1?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


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



Sue Mosher [MVP-Outlook] October 30th 07 08:28 PM

Outlook 2003: Personalized form with VB-Script and VB.NET
 
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.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


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


"Sue Mosher [MVP-Outlook]" schrieb im Newsbeitrag
...
Would the user normally be able to change MB1 manually? Does the VBScript
code need to handle any changes in MB1?
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


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



Oskar Vaia October 31st 07 10:34 AM

Outlook 2003: Personalized form with VB-Script and VB.NET
 
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



All times are GMT +1. The time now is 12:15 PM.

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