|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Hi, Is it possible to add a custom form to an Appointment Item and contols to that custom form in C# and make the form visible with out publishing the form ? What I want to do (and dont know if is possible) is if a user has the add-in installed and opens an Appointment Item, the Appointment Item will display the custom form but if user sends the appointment (meeting request) to other users, it sends the normal appointment item without the custom form.
|
|
I doubt that it would work. Adding controls programmatically embeds the form definition into the item, so it would probably travel with the meeting request. Either wait for Outlook 2007 and form regions or use the third-party component at http://www.add-in-express.com/outlook-extension/ to accomplish the same thing in earlier versions. -- 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 "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:78780F2C-31BB-4C20-9DE8-E8FEB0D5B75D[ at ]microsoft.com...
[Quoted Text] > Hi, > Is it possible to add a custom form to an Appointment Item and contols > to that custom form in C# and make the form visible with out publishing the > form ? What I want to do (and dont know if is possible) is if a user has the > add-in installed and opens an Appointment Item, the Appointment Item will > display the custom form but if user sends the appointment (meeting request) > to other users, it sends the normal appointment item without the custom form.
|
|
An item of any type doesn't get a custom form added, it either uses a custom form or uses the standard form for that Class of item.
It's never a good idea to add controls at runtime to a form, that one-offs the item and causes various bad things. The best approach is to use an already published custom form and set the MessageClass of the item to that MessageClass to display your custom controls. After you display/harvest data from the item you can then change the MessageClass back to its original setting.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
"lg" <lg[ at ]discussions.microsoft.com> wrote in message news:78780F2C-31BB-4C20-9DE8-E8FEB0D5B75D[ at ]microsoft.com...
[Quoted Text] > Hi, > Is it possible to add a custom form to an Appointment Item and contols > to that custom form in C# and make the form visible with out publishing > the > form ? What I want to do (and dont know if is possible) is if a user has > the > add-in installed and opens an Appointment Item, the Appointment Item will > display the custom form but if user sends the appointment (meeting > request) > to other users, it sends the normal appointment item without the custom > form.
|
|
Thanks for the help Ken and hi Sue, I am working with Outlook 2003, is there any way of adding a custom form in the New_Inspector event and when the user selects Send (arranging a meeting with other users), in the send event remove the custom form and send the appointment item as normal without the custom form and therefore not one-offing the form.
|
|
It might be possible in the AppointmentItem.Send event handler, but my experience is that anything involving custom forms and meeting requests is a little dicey. -- 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 "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:33567EEA-3F0B-40F0-ADC5-515474E160EA[ at ]microsoft.com...
[Quoted Text] > Thanks for the help Ken and hi Sue, I am working with Outlook 2003, is there > any way of adding a custom form in the New_Inspector event and when the user > selects Send (arranging a meeting with other users), in the send event remove > the custom form and send the appointment item as normal without the custom > form and therefore not one-offing the form. >
|
|
I can remove the controls from the custom form in the send event but when it comes to removing the custom form itself (the tab on the appointment item) in the event it dosnt work. I have also tried hiding the custom form also using the "HideFormPage" method and that dosnt seem to work either.
I saw on another thread where you suggected to hide the form before publishing it and then show it when needed but I am afraid it did'nt work here. Do you have any suggestions why ?
|
|
|
[Quoted Text] > I saw on another thread where you suggected to hide the form before > publishing it and then show it when needed but I am afraid it did'nt work > here. Do you have any suggestions why ?
What in particular didn't work? Code snippet?
-- 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 "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:E6CB22DE-8295-453D-A88F-A2C4F7989C07[ at ]microsoft.com... >I can remove the controls from the custom form in the send event but when it > comes to removing the custom form itself (the tab on the appointment item) in > the event it dosnt work. I have also tried hiding the custom form also using > the "HideFormPage" method and that dosnt seem to work either.
|
|
private void ThisApplication_Startup(object sender, System.EventArgs e) {
...........
// Get the form Description and publish it. "appointmentItem" is an object // to the custom form returned from "CreateItemFromTemplate" appointmentItem.GetInspector.HideFormPage ("TestPage");
formDescription = appointmentItem.FormDescription; formDescription.Name = "Appointment"; formDescription.PublishForm( Microsoft.Office.Interop.Outlook.OlFormRegistry.olFolderRegistry, MAPIFolder); }
public void New_Inspector(Outlook.Inspector Inspector) { .............. Inspector.ShowFormPage("TestPage"); }
(The checks to make sure that a appointment item is opened are omitted.) When a new appointment item is opened the "TestPage" form is still not visible but if you go into the design mode of the item the TestPage there.
|
|
You need to create the form to look the way you want it to -- including hiding any necessary pages -- before you save it as an .oft form template file.
Check for a typo in the page name string. Trailing spaces matter.
-- 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 "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:E4C59F26-B3D4-465F-AC28-78D9B86A83DE[ at ]microsoft.com...
[Quoted Text] > private void ThisApplication_Startup(object sender, System.EventArgs e) > { > > ........... > > // Get the form Description and publish it. "appointmentItem" is an > object > // to the custom form returned from "CreateItemFromTemplate" > appointmentItem.GetInspector.HideFormPage ("TestPage"); > > formDescription = appointmentItem.FormDescription; > formDescription.Name = "Appointment"; > formDescription.PublishForm( > Microsoft.Office.Interop.Outlook.OlFormRegistry.olFolderRegistry, > MAPIFolder); > } > > public void New_Inspector(Outlook.Inspector Inspector) > { > .............. > Inspector.ShowFormPage("TestPage"); > } > > (The checks to make sure that a appointment item is opened are omitted.) > When a new appointment item is opened the "TestPage" form is still not > visible but if you go into the design mode of the item the TestPage there.
|
|
I see what one of the problems might be, I was create a generic AppointmentItem object using the "CreateItem" method, adding the custom form (the new tab) and the controls, then publishing the AppointItem object. It sometimes work when I read in from the oft file but I think there is some sort of caching issue with Outlook. I get some weird results though, when I was the NewInspector event to show the custom form it sometimes work but if I use the Open event it seem to work better, do you know why this is ?
"Sue Mosher [MVP-Outlook]" wrote:
[Quoted Text] > You need to create the form to look the way you want it to -- including hiding any necessary pages -- before you save it as an .oft form template file. > > Check for a typo in the page name string. Trailing spaces matter. > > -- > 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> > "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:E4C59F26-B3D4-465F-AC28-78D9B86A83DE[ at ]microsoft.com... > > private void ThisApplication_Startup(object sender, System.EventArgs e) > > { > > > > ........... > > > > // Get the form Description and publish it. "appointmentItem" is an > > object > > // to the custom form returned from "CreateItemFromTemplate" > > appointmentItem.GetInspector.HideFormPage ("TestPage"); > > > > formDescription = appointmentItem.FormDescription; > > formDescription.Name = "Appointment"; > > formDescription.PublishForm( > > Microsoft.Office.Interop.Outlook.OlFormRegistry.olFolderRegistry, > > MAPIFolder); > > } > > > > public void New_Inspector(Outlook.Inspector Inspector) > > { > > .............. > > Inspector.ShowFormPage("TestPage"); > > } > > > > (The checks to make sure that a appointment item is opened are omitted.) > > When a new appointment item is opened the "TestPage" form is still not > > visible but if you go into the design mode of the item the TestPage there. >
|
|
NewInspector is an event that fires when the user displays an item. Whether it uses a custom form depends on the value of the MessageClass property, if it's a stored item, or what method was used to create the item if it's a new item. If you want to change the value of MessageClass, you must use the MailItem.Open event handler, change the MessageClass, save the item, get its MesssageClass, cancel the Open event, then open the item programmatically using GetItemFromID.
In other words, you can't change the form for an item on the fly without saving it and getting it as a completely new Inspector.
-- 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 "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:F9360D1B-B2A0-47D3-9C18-14102FEA555E[ at ]microsoft.com...
[Quoted Text] >I see what one of the problems might be, I was create a generic > AppointmentItem object using the "CreateItem" method, adding the custom form > (the new tab) and the controls, then publishing the AppointItem object. It > sometimes work when I read in from the oft file but I think there is some > sort of caching issue with Outlook. I get some weird results though, when I > was the NewInspector event to show the custom form it sometimes work but if I > use the Open event it seem to work better, do you know why this is ? > > "Sue Mosher [MVP-Outlook]" wrote: > >> You need to create the form to look the way you want it to -- including hiding any necessary pages -- before you save it as an .oft form template file. >> >> Check for a typo in the page name string. Trailing spaces matter. >> >> -- >> 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>> >> "lg" <lg[ at ]discussions.microsoft.com> wrote in message news:E4C59F26-B3D4-465F-AC28-78D9B86A83DE[ at ]microsoft.com... >> > private void ThisApplication_Startup(object sender, System.EventArgs e) >> > { >> > >> > ........... >> > >> > // Get the form Description and publish it. "appointmentItem" is an >> > object >> > // to the custom form returned from "CreateItemFromTemplate" >> > appointmentItem.GetInspector.HideFormPage ("TestPage"); >> > >> > formDescription = appointmentItem.FormDescription; >> > formDescription.Name = "Appointment"; >> > formDescription.PublishForm( >> > Microsoft.Office.Interop.Outlook.OlFormRegistry.olFolderRegistry, >> > MAPIFolder); >> > } >> > >> > public void New_Inspector(Outlook.Inspector Inspector) >> > { >> > .............. >> > Inspector.ShowFormPage("TestPage"); >> > } >> > >> > (The checks to make sure that a appointment item is opened are omitted.) >> > When a new appointment item is opened the "TestPage" form is still not >> > visible but if you go into the design mode of the item the TestPage there. >>
|
|
Usually in the NewInspector event handler the only properties of Inspector.CurrentItem that may be available are MessageClass and Class, EntryID may also be available. You are best waiting for the first Activate of the Inspector.
But, as Sue mentioned sending meeting requests and trying to fudge things is a frustrating exercise.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
"lg" <lg[ at ]discussions.microsoft.com> wrote in message news:33567EEA-3F0B-40F0-ADC5-515474E160EA[ at ]microsoft.com...
[Quoted Text] > Thanks for the help Ken and hi Sue, I am working with Outlook 2003, is > there > any way of adding a custom form in the New_Inspector event and when the > user > selects Send (arranging a meeting with other users), in the send event > remove > the custom form and send the appointment item as normal without the custom > form and therefore not one-offing the form. >
|
|
And trying to make certain changes in Item.Send usually will fail. You might have to cancel the send, set a timer to fire after the send event terminates and mark the item or a flag in your Inspector class handler and then do the changes in the timer event handler, then send the item again.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> wrote in message news:%23LR4WSepGHA.524[ at ]TK2MSFTNGP05.phx.gbl... NewInspector is an event that fires when the user displays an item. Whether it uses a custom form depends on the value of the MessageClass property, if it's a stored item, or what method was used to create the item if it's a new item. If you want to change the value of MessageClass, you must use the MailItem.Open event handler, change the MessageClass, save the item, get its MesssageClass, cancel the Open event, then open the item programmatically using GetItemFromID.
In other words, you can't change the form for an item on the fly without saving it and getting it as a completely new Inspector.
-- 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
|
|
|