This affiliate shows you how to assignment with Outlook anatomy regions, which lets you do things like add pages to the Inspector window, alter all the absolute pages in an Inspector window with your own page, or berth some custom UI assimilate an absolute page.
In Outlook 2007, developers accept the adeptness to extend the Outlook UI by creating a appropriate affectionate of Outlook addendum alleged an Outlook anatomy region. Anatomy regions are acclimated primarily to adapt Inspector windows, which we alien in Affiliate 10, “Working with Outlook Events.” Inspector windows are the Outlook windows that arise aback you double-click an Outlook item—a mail account in your inbox or a assignment in a assignment list, for example. With anatomy regions you can do things like add pages to the Inspector window, alter all the absolute pages in an Inspector window with your own page, or berth some custom UI assimilate an absolute page. You can additionally use a assertive blazon of Outlook anatomy arena (an Aing anatomy region) to adapt the account area in Outlook Explorer windows.
To actuate our analysis of Outlook anatomy regions, let’s actualize a simple one by appliance Beheld Studio 2008. Start by creating a new Outlook add-in activity by allotment File > New > Project. In the New Activity chat box that appears, actualize a new Outlook 2007 add-in, as apparent in Figure 16-1.
Now, in your new add-in project, accept Activity > Add New Item. Bang the Office chic to clarify to appearance aloof the Office-specific items. In the account of Office items, bang Outlook Anatomy Region, as apparent in Figure 16-2. Name the anatomy region—just use the absence name FormRegion1. Again bang the Add on.
Figure 16-2 Adding an Outlook anatomy arena to an Outlook 2007 add-in project.
A astrologer appears, as apparent in Figure 16-3. The aboriginal footfall in the astrologer is to adjudge whether you appetite to actualize an Outlook anatomy arena or acceptation a anatomy arena that was advanced advised in Outlook with Outlook’s congenital anatomy designer. For this introduction, bang Architecture a New Anatomy Region. This advantage lets you use Windows Forms and keeps our alteration acquaintance aural Beheld Studio. After in the affiliate we appearance you how to use the Outlook congenital anatomy designer, as able-bodied as altercate aback you adeptness appetite to use Outlook’s anatomy artist instead of Windows Forms.
Figure 16-3 Selecting the anatomy technology to use to actualize the anatomy region.
After you adjudge whether to architecture a new anatomy arena with Windows Forms or to acceptation an absolute Outlook anatomy arena advised in Outlook, bang the Aing on to move to the added folio of the wizard, apparent in Figure 16-4, which allows you to aces the blazon of anatomy arena you appetite to create.
Figure 16-4 Selecting the blazon of anatomy arena to create: Separate.
To accept the types of anatomy regions that are accessible in Figure 16-4, we charge booty a footfall aback and altercate Inspector windows in some added detail. Anatomy regions are acclimated primarily in Outlook Inspector windows. An Outlook Inspector window can accept assorted pages associated with it, and Ribbon ons are acclimated to about-face amid the pages associated with a accurate Inspector window. Accede the Inspector window that appears aback you double-click an Outlook task, as apparent in Figure 16-5.
Figure 16-5 A assignment Inspector window with the Assignment folio selected.
Figure 16-5 has two Ribbon ons in the Appearance group: Assignment and Details. In Figure 16-5 the Assignment on is alleged and the Assignment folio is displayed. The Assignment folio is the absence folio for the Assignment Inspector window and is displayed aboriginal whenever a assignment is opened. If you bang the Details on, the appearance changes to the Details page, as apparent in Figure 16-6.
Figure 16-6 A Assignment Inspector window with the Details folio selected.
With this background, you’re accessible to go aback to Figure 16-4 and accomplish faculty of the options. A Separate anatomy arena adds a new folio (and a new Ribbon on to actuate that page) to an Inspector window. So you could add a new folio to the Assignment Inspector window to appearance article like subtasks that charge be completed to accomplishment the capital task. In Figure 16-4 the astrologer additionally displays a nice clear to advice you bethink what a Separate anatomy arena is. In this case the clear emphasizes that you get a new Ribbon on to affectation the new page, and you accept complete ascendancy of the new folio that is shown.
Figure 16-7 shows what the astrologer displays aback you baddest Replacement instead of Separate as the blazon of anatomy region. A Replacement anatomy arena allows you to alter the absence folio of the Inspector window. So in the assignment example, you could alter the Assignment folio (the absence folio for a Assignment Inspector window), but the Details folio would still be available.
Figure 16-7 Selecting the blazon of anatomy arena to create: Replacement.
Figure 16-8 shows what the astrologer displays aback you baddest Replace-All as the blazon of anatomy region. A Replace-All anatomy arena allows you to alter all accessible pages and accomplish your folio accessible alone in the Inspector window. So in the assignment example, you could alter both the Assignment folio and the Details page; your folio would be the alone folio displayed in the Inspector window.
Figure 16-8 Selecting the blazon of anatomy arena to create: Replace-All.
When you anticipate about Replacement and Replace-All anatomy arena types, you apprehend that replacing the absence pages for an Outlook account blazon is a appealing able capability—actually too powerful, in a way, because you could change the absence folio for an Outlook account type, such as a task, and apparatus a new absence folio that prevents the user from alteration key abstracts associated with that task. You may balloon to accommodate a way to set the antecedence of a assignment in your Replacement or Replace-All anatomy region, for example. Indeed, the creators of Outlook didn’t appetite to accord you absolutely that abundant power, abundant to possibly breach key functionality of Outlook.
To jump advanced a little, baddest Replacement or Replace-All as the anatomy arena blazon and again skip two accomplish advanced in the astrologer by beat the Aing on twice. You see the astrologer folio apparent in Figure 16-9, area you actuate which Outlook bulletin classes you appetite this anatomy arena to be associated with. Aback you baddest Replacement or Replace-All, apprehension that all the accepted bulletin classes (Appointment, Contact, Task, and so on) are grayed out in this chat box. Outlook won’t let you alter the absence folio or alter all the pages for accepted bulletin classes because you may breach key appearance of Outlook. To use Replacement and Replace-All anatomy arena types, you charge ascertain a custom bulletin class. A custom bulletin chic can reclaim all the absolute functionality of a congenital bulletin chic such as Appointment, Contact, or Assignment and acts as a specialized adaptation of those congenital Outlook account objects. We altercate alive with custom bulletin classes in added detail after in this chapter, in the area “Form Arena Types and Custom Bulletin Classes,” because you charge accept that abstraction to use Replacement and Replace-All anatomy arena types.
Figure 16-9 Replacement and Replace-All anatomy regions can be associated alone with custom bulletin classes.
Moving aback to the folio in the astrologer area you aces the anatomy arena type, accede the final anatomy arena type: Adjoining, apparent in Figure 16-10. An Aing anatomy arena is added to the basal of the absence folio for an Inspector. Assorted aing anatomy regions can be associated with the aforementioned bulletin class, so potentially you can accept several Aing anatomy regions displayed in one Inspector window’s absence page. Aing anatomy regions accept headers that acquiesce them to be burst and broadcast to accomplish added allowance in the absence folio aback needed.
Figure 16-10 Selecting the blazon of anatomy arena to create: Adjoining.
Another absorbing appliance of an Aing anatomy arena is in an Explorer window. Specifically, an Aing anatomy arena can be acclimated in the account area that is displayed in an Explorer window. In abundant the aforementioned way that they are acclimated in the absence folio of an Inspector window, assorted Aing anatomy regions can be associated with an Outlook bulletin chic and can be displayed in the account pane. Anatomy regions displayed in the account area can additionally be burst to their headers. Replacement and Replace-All anatomy regions can be acclimated in the account area as well, although in this case they alter what is apparent in the account folio and can be acclimated alone for custom bulletin classes.
Now that you’re accustomed with all the anatomy arena types, baddest Aing as the anatomy arena blazon and bang the Aing on to move to the aing folio of the wizard, apparent in Figure 16-11. In this chat box, you set the name for the anatomy arena that will be displayed in the UI, so aces a affable name. Title and Description are grayed out because you’re creating an Aing anatomy region; those options are enabled alone for Replacement and Replace-All anatomy arena types.
Figure 16-11 Ambience anecdotic argument and affectation preferences.
This folio of the astrologer additionally has three analysis boxes that specify aback the anatomy arena is displayed. The aboriginal analysis box sets whether the anatomy arena is displayed for an Inspector window that is in compose mode. An Inspector window is in compose approach aback you actualize a new instance of the Outlook account associated with it—when you actualize a new task, for example. The added analysis box sets whether the anatomy arena is displayed for an Inspector window that is in apprehend mode. An Inspector window is in apprehend approach aback you accessible an absolute item—a mail message, for example. Finally, the third analysis box sets whether to affectation the anatomy arena in reading-pane view.
For this example, accumulate all the boxes arrested and bang the Aing on to aces which Outlook bulletin classes to accessory the anatomy arena with, as apparent in Figure 16-12. For this example, baddest Task. Note that you can accessory the aforementioned anatomy arena with assorted congenital Outlook bulletin classes. You could accept a anatomy arena that displays for both Tasks and Mail messages, for example. You can additionally accessory a anatomy arena with custom bulletin classes, which we altercate after in this chapter. As we call beforehand in this section, Replacement and Replace-All anatomy arena types can be associated alone with custom bulletin classes.
Figure 16-12 Picking which bulletin classes will affectation a anatomy region.
Associate the anatomy arena with the congenital Assignment type, and bang the Accomplishment on to avenue the wizard. Beheld Studio creates a new activity account alleged FormRegion1.cs, as apparent in Figure 16-13. It displays a beheld artist in which you can annoyance and bead Windows Forms controls from the toolbox to assemble the anatomy region. This beheld artist is abundant like the one you use to architecture user controls and assignment panes.
Figure 16-13 The anew created anatomy arena activity account in beheld architecture view.
Your ambition is to add a anatomy arena in which subtasks can be associated with a task. First, annoyance and bead a account box ascendancy and a on to actualize a new assignment and annul an absolute task. Because the user can resize the anatomy region, use the Ballast acreage of the controls to ballast the account box to the top, left, bottom, and right, and ballast the ons to the basal and left. Figure 16-14 shows the final anatomy region.
Before you go any further, run the add-in activity and see what happens. Press F5 to body and run Outlook with the add-in activity loaded. If you bang a assignment in a assignment account and appearance account appearance (by allotment Appearance > Account Area > Bottom), you see that the aing anatomy arena is displayed docked at the basal of reading-pane appearance for a task, as apparent in Figure 16-15. If you double-click a task, the Aing anatomy arena is docked at the basal of the absence folio for the Inspector window, as apparent in Figure 16-16. After you’ve run your project, if you appetite to aish the anatomy arena and add-in from Outlook, accept Body > Clean.
Figure 16-16 An Aing anatomy arena in the absence folio of an Inspector window.
Let’s appraise the aing anatomy arena a little more. First, apprehension that the Name you defined in Figure 16-11 is displayed as the explanation aloft the Aing anatomy region. To the larboard of the anatomy arena explanation is a −/ on that expands and collapses the anatomy region. In Figure 16-17 you see what an Aing anatomy arena looks like aback it is collapsed. Bethink that several Aing anatomy regions could be displayed in one Inspector window or account pane; the adeptness to aggrandize and collapse them is important, because it allows the end user to administer awning absolute estate.
Also, apprehension that aback you resize the account area or the Inspector window, the anatomy arena has a absence height. Aback the user adjusts the admeasurement of the anatomy region, Outlook remembers the acme and uses that acme the aing time the account appearance is displayed. If you admeasurement the window baby abundant that the absence acme of the anatomy arena can’t be displayed, a vertical annal bar appears, as apparent in Figure 16-18. This minimum acme represents the acme you set aback you advised the anatomy region. To accept a abate or beyond minimum height, artlessly acclimatize the acme of the beheld architecture apparent for the anatomy arena central Beheld Studio.
Figure 16-18 The aftereffect of absence acme on the anatomy region’s vertical annal bar.
Now avenue Outlook and go aback to the add-in activity to put some cipher abaft the anatomy region. Right-click FormRegion1.cs in the Solution Explorer, and accept Appearance Cipher from the ambience menu. The absence cipher for a anatomy arena is apparent in Listing 16-1. There are three accident handlers of absorption in our chic FormRegion1. The aboriginal is absolutely in a nested chic alleged FormRegion1Factory. This nested chic provides a adjustment alleged FormRegion1Factory_FormRegionInitializing area you can address cipher to adjudge whether to appearance the anatomy arena for a accustomed Outlook item. The FormRegionInitializing accident abettor is anesthetized a constant e of blazon FormRegionInitializingEventArgs that can be acclimated to get the Outlook account that the anatomy arena is about to be apparent for (e.OutlookItem) and to aish the assuming of the anatomy arena if all-important by ambience e.Cancel to true. Don’t authority a advertence to the Outlook account (e.OutlookItem) that is about to be shown; it is provided for use alone during the accident handler.
The anatomy arena chic itself (FormRegion1) has a FormRegionShowing accident abettor that is invoked afore the anatomy arena is displayed (but too backward to anticipate the affectation of the anatomy arena altogether; that is what FormRegionInitializing is for). In the FormRegionShowing accident handler, you can address cipher to initialize your anatomy region. In this accident handler, you can use the acreage this.OutlookItem to admission the Outlook account associated with the anatomy region.
When the anatomy arena is closed, the FormRegionClosed accident abettor is invoked. This accident abettor is a acceptable abode to save any changes fabricated to the Outlook account by your anatomy arena and to do any final cleanup.
Listing 16-2 shows a simple accomplishing for the subtasks anatomy region. You don’t charge to address any cipher in FormRegionInitializing because you consistently appetite to affectation your anatomy region. In FormRegionShowing, address some cipher to get a custom UserProperty article from the Outlook account with which the anatomy arena is associated. The custom UserProperty we will accessory with the Outlook account will accept the identifier “SubTasks” You’ll use this custom UserProperty to abundance the subtasks that are edited by the anatomy region. If the UserProperty isn’t associated with the Outlook account yet, actualize the UserProperty for the Outlook account in FormRegionInitializing. The “SubTasks” user acreage contains a cord amount that contains subtasks belted by a new line. You anatomize any subtasks that are in the cord and abide the account box for the anatomy arena with the subtasks.
In FormRegionClosed, you do the reverse: Grab all the entries out of the account box and concatenate them into a cord in which subtasks are afar by new lines. If the subtasks accept been changed, set the “SubTasks” UserProperty’s amount to the new cord and save the associated Outlook item.
Finally, a simple accomplishing for the Add on aloof adds the accepted time as a new subtask; a complete accomplishing would accommodate a chat box with an adapt box in which the user could blazon a subtask description. The Annul on deletes the alleged account item.
When you run the anatomy region, it displays as before, but now the Add and Annul ons work, and you can add subtasks (set to the accepted time) to the accepted task.
Ten Ways On How To Get The Most From This Create A Form In Outlook | Create A Form In Outlook – create a form in outlook
| Pleasant for you to my own blog, within this time period I will demonstrate with regards to create a form in outlook