Accessing Outlook Custom Forms and User Defined Fields

Add-in Express™ Support Service
That's what is more important than anything else

Accessing Outlook Custom Forms and User Defined Fields
How do you access the user defined forms and fields.. 
David Kim

Posts: 4
Joined: 2009-02-12
I am trying to open a custom outlook form I have created and want to check the user defined fields in this form on a close event. I know the commands in VB script but need to know the same commands in ADX Add-In Express.

1) To Open a New Custom Form.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.Application.GetNamespace("MAPI")
Set myfolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("Bugs").Folders("Bug Tracking")

Set myItem = myFolder.Items.Add("IPM.Task.BugTracking")


2) To Access a User Defined Field

Function Item_Close()

If Item.Subject = "" Then
Item.UserProperties("tmpIsNew").Value = True
Item.UserProperties("tmpIsNew").Value = False
End If

End Function
Posted 18 Feb, 2009 17:34:23 Top
Andrei Smolin

Add-in Express team

Posts: 15497
Joined: 2006-05-11
Hello David,

1) To Open a New Custom Form.

Add-in Express add-ins targeting Outlook provide the OutlookApp property which returns an Outlook.Application. Below is a raw sketch:

dim myNameSpace as Outlook.Namespace = OutlookApp.Session
Dim myfolder as Outlook.MAPIFolder = myNameSpace.Folders.Item("Public Folders").Folders.Items("...")
dim item as Object = myFolder.Items.Add("IPM.Task.BugTracking") 
dim taskItem as Outlook.TaskItem = CType(item, Outlook.TaskItem)

2) To Access a User Defined Field
Replace UserProperties("...") with UserProperties.Item("...").

Now please read my post on releasing COM objects in .NET add-ins; releasing COM objects is a must in Outlook add-ins. Say in 1) you must release myNameSpace, myfolder, taskItem (or item) as well as all COM objects that you get via Folders and Folders.Item(...). The same applies to UserProperties and UserProperties.Item("...").

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Feb, 2009 09:24:35 Top