![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have created a new Region (seperate type). I now want ot communicate with
that form from an outside windows application. when i run the code shown below, i get an error because it can't find the user properties that the code is requesting. However if i open up the Account form then the actual new region form, then suddenly all the user properties are available. Is their a way to communicate with the regions (seperate type) User properties (UDFs) with out having to open the matching form in out look itself? Dim app As New Outlk.Application Dim olns As Outlk.NameSpace = app.GetNamespace("MAPI") Dim olFolders As Outlk.Folders = olns.Session.Folders Dim RootFolder As Outlk.Folder = olFolders("Business Contact Manager") Dim AccountsFldr As Outlk.Folder = RootFolder.Folders("Accounts") Dim newAccount As Outlk.ContactItem = Nothing Dim userProp As Outlk.UserProperty = Nothing newAccount = AccountsFldr.Items.Find("[Subject]='Account2 Name'") 'the error occures on this line because it cannot find the UDF Called Carrier userProp = newAccount.UserProperties.Find("Carrier") |
#2
|
|||
|
|||
![]()
The symptoms suggest that the property doesn't exist on the item yet. You'll need to add it using the UserProperties.Add method if it doesn't already exist on the individual item.
This isn't a problem when the user opens the item, because opening it invokes the form region, which causes the necessary properties to be created. -- 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 "Vbasiccode" wrote in message ... I have created a new Region (seperate type). I now want ot communicate with that form from an outside windows application. when i run the code shown below, i get an error because it can't find the user properties that the code is requesting. However if i open up the Account form then the actual new region form, then suddenly all the user properties are available. Is their a way to communicate with the regions (seperate type) User properties (UDFs) with out having to open the matching form in out look itself? Dim app As New Outlk.Application Dim olns As Outlk.NameSpace = app.GetNamespace("MAPI") Dim olFolders As Outlk.Folders = olns.Session.Folders Dim RootFolder As Outlk.Folder = olFolders("Business Contact Manager") Dim AccountsFldr As Outlk.Folder = RootFolder.Folders("Accounts") Dim newAccount As Outlk.ContactItem = Nothing Dim userProp As Outlk.UserProperty = Nothing newAccount = AccountsFldr.Items.Find("[Subject]='Account2 Name'") 'the error occures on this line because it cannot find the UDF Called Carrier userProp = newAccount.UserProperties.Find("Carrier") |
#3
|
|||
|
|||
![]() so should i replace the line userProp = newAccount.UserProperties.Find("Carrier") with userProp = itemContact.UserProperties.Add("Carrier", olText) for each of the properties in the Form Region? "Sue Mosher [MVP-Outlook]" wrote: The symptoms suggest that the property doesn't exist on the item yet. You'll need to add it using the UserProperties.Add method if it doesn't already exist on the individual item. This isn't a problem when the user opens the item, because opening it invokes the form region, which causes the necessary properties to be created. -- 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 "Vbasiccode" wrote in message ... I have created a new Region (seperate type). I now want ot communicate with that form from an outside windows application. when i run the code shown below, i get an error because it can't find the user properties that the code is requesting. However if i open up the Account form then the actual new region form, then suddenly all the user properties are available. Is their a way to communicate with the regions (seperate type) User properties (UDFs) with out having to open the matching form in out look itself? Dim app As New Outlk.Application Dim olns As Outlk.NameSpace = app.GetNamespace("MAPI") Dim olFolders As Outlk.Folders = olns.Session.Folders Dim RootFolder As Outlk.Folder = olFolders("Business Contact Manager") Dim AccountsFldr As Outlk.Folder = RootFolder.Folders("Accounts") Dim newAccount As Outlk.ContactItem = Nothing Dim userProp As Outlk.UserProperty = Nothing newAccount = AccountsFldr.Items.Find("[Subject]='Account2 Name'") 'the error occures on this line because it cannot find the UDF Called Carrier userProp = newAccount.UserProperties.Find("Carrier") |
#4
|
|||
|
|||
![]()
Not quite. You should keep the statement you already have, but test whether userProp Is Nothing before you do anything with it. If it is Nothing, then add the property.
-- 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 "Vbasiccode" wrote in message ... so should i replace the line userProp = newAccount.UserProperties.Find("Carrier") with userProp = itemContact.UserProperties.Add("Carrier", olText) for each of the properties in the Form Region? "Sue Mosher [MVP-Outlook]" wrote: The symptoms suggest that the property doesn't exist on the item yet. You'll need to add it using the UserProperties.Add method if it doesn't already exist on the individual item. This isn't a problem when the user opens the item, because opening it invokes the form region, which causes the necessary properties to be created. "Vbasiccode" wrote in message ... I have created a new Region (seperate type). I now want ot communicate with that form from an outside windows application. when i run the code shown below, i get an error because it can't find the user properties that the code is requesting. However if i open up the Account form then the actual new region form, then suddenly all the user properties are available. Is their a way to communicate with the regions (seperate type) User properties (UDFs) with out having to open the matching form in out look itself? Dim app As New Outlk.Application Dim olns As Outlk.NameSpace = app.GetNamespace("MAPI") Dim olFolders As Outlk.Folders = olns.Session.Folders Dim RootFolder As Outlk.Folder = olFolders("Business Contact Manager") Dim AccountsFldr As Outlk.Folder = RootFolder.Folders("Accounts") Dim newAccount As Outlk.ContactItem = Nothing Dim userProp As Outlk.UserProperty = Nothing newAccount = AccountsFldr.Items.Find("[Subject]='Account2 Name'") 'the error occures on this line because it cannot find the UDF Called Carrier userProp = newAccount.UserProperties.Find("Carrier") |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Communicate with a Form Region | Vbasiccode | Outlook - Using Forms | 5 | May 9th 07 10:51 PM |
Country/Region in Contacts | Jack | Outlook - General Queries | 3 | March 24th 07 12:00 PM |
forward an attachment with form region | Nikolas | Outlook - Using Forms | 4 | March 16th 07 10:44 AM |
only one instance of form region is displayed | Nikolas | Outlook - Using Forms | 4 | October 6th 06 03:37 PM |
BLANK REGION/COUNTRY LIST | ed | Outlook - Using Contacts | 1 | May 30th 06 09:50 AM |