Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / July 2004

Tip: Looking for answers? Try searching our database.

Programmatically Update Custom Form Description

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Reb DeWinter - 28 Jul 2004 23:24 GMT
Is there a way to programmatically update a custom form description?  Manually I would just make the changes to the custom form, run the form and then use "Publish Form As" to overwrite the existing form definition.
Signature

Thanks and best regards,

Reb Dewinter

Sue Mosher [MVP-Outlook] - 28 Jul 2004 23:54 GMT
In general, you'd do the same thing programmatically, using the
FormDefinition.PublishForm method. But of course, we don't know what changes
you have in mind, so it's impossible to say if they can be done.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Is there a way to programmatically update a custom form description?  Manually I would just make the changes to the custom form, run the form and
then use "Publish Form As" to overwrite the existing form definition.
Reb DeWinter - 29 Jul 2004 00:56 GMT
All I did was change the values in a custom combobox control.  When I display the form, the changes seem to work, but then they don't appear when I open a new form.  Here is a code snipped of how I tried to use the PublishForm procedure:

m_olNameSpace = myOlApp.GetNamespace("MAPI")
           ConFolder = m_olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
           ActFolder = m_olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderJournal)
           myContact = CType(ConFolder.Items.Add("IPM.Contact.Test Contact"), Outlook.ContactItem)
           
'Clear out curent items listed in form field
                   oldValCount = myContact.GetInspector.ModifiedFormPages("General").controls("Test Field").listcount - 1
                   Dim k As Integer
                   For k = 0 To oldValCount
                       myContact.GetInspector.ModifiedFormPages("General").controls("Test Field").removeitem(0)
                   Next

                   'Add Revised List
                   ValCount = lsvValues.Items.Count - 1
                   Dim i As Integer
                   For i = 0 To ValCount
                       myField = lsvValues.Items.Item(i).Text
                       myContact.GetInspector.ModifiedFormPages("General").controls("Test Field").additem(myField)
                   Next

                   'display item for development purposes
                   myContact.Display()
                   myContact.Save()
                   Dim oFormDesc As Outlook.FormDescription
                   oFormDesc = myContact.FormDescription
                   oFormDesc.Name = "Test Contact"
                   oFormDesc.PublishForm(Outlook.OlFormRegistry.olFolderRegistry, ConFolder)

Signature

Thanks and best regards,

Reb Dewinter

> In general, you'd do the same thing programmatically, using the
> FormDefinition.PublishForm method. But of course, we don't know what changes
[quoted text clipped - 3 lines]
> Manually I would just make the changes to the custom form, run the form and
> then use "Publish Form As" to overwrite the existing form definition.
Sue Mosher [MVP-Outlook] - 29 Jul 2004 01:26 GMT
The change you made -- using ItemAdd to fill a list box -- is not
persistent, because you haven't really changed the **design** of the form,
only the runtime UI. To change the design and persist that change, you'd
need to set the control's PossibleValues property. A possibly better
approach is to include code to fill the list box in your form's Item_Open
event.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> All I did was change the values in a custom combobox control.  When I display the form, the changes seem to work, but then they don't appear when
I open a new form.  Here is a code snipped of how I tried to use the
PublishForm procedure:

> m_olNameSpace = myOlApp.GetNamespace("MAPI")
>             ConFolder = m_olNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
[quoted text clipped - 3 lines]
> 'Clear out curent items listed in form field
>                     oldValCount = myContact.GetInspector.ModifiedFormPages("General").controls("Test
Field").listcount - 1
>                     Dim k As Integer
>                     For k = 0 To oldValCount

myContact.GetInspector.ModifiedFormPages("General").controls("Test
Field").removeitem(0)
>                     Next
>
[quoted text clipped - 3 lines]
>                     For i = 0 To ValCount
>                         myField = lsvValues.Items.Item(i).Text

myContact.GetInspector.ModifiedFormPages("General").controls("Test
Field").additem(myField)
>                     Next
>
[quoted text clipped - 4 lines]
>                     oFormDesc = myContact.FormDescription
>                     oFormDesc.Name = "Test Contact"

oFormDesc.PublishForm(Outlook.OlFormRegistry.olFolderRegistry, ConFolder)

> > In general, you'd do the same thing programmatically, using the
> > FormDefinition.PublishForm method. But of course, we don't know what changes
[quoted text clipped - 3 lines]
> > Manually I would just make the changes to the custom form, run the form and
> > then use "Publish Form As" to overwrite the existing form definition.
Reb DeWinter - 29 Jul 2004 02:48 GMT
Thanks, Sue - the PossibleValues field worked and I would never have known about it since it is not in the help documentation!
Signature

Thanks and best regards,

Reb Dewinter

> The change you made -- using ItemAdd to fill a list box -- is not
> persistent, because you haven't really changed the **design** of the form,
[quoted text clipped - 55 lines]
> and
> > > then use "Publish Form As" to overwrite the existing form definition.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.