Now that you know what the Exchange Web Services Windows Vista Gadget sample application does, let's take a look at how it's built.
Directory Structure
When you install the Exchange Web Services Windows Vista Gadget sample application, the folder C:\Users\username\AppData\Local\Microsoft\Windows Sidebar\Gadgets\ExchangeWebServices.gadget\ is created. This folder contains all application folders and files.
The sample application directory structure consists of one top-level folder and three subfolders, as described in the following table.
Sample application directory structure
|
Folder
|
Description
|
|---|
|
ExchangeWebServices.gadget\
|
Contains the main gadget configuration file and the HTML files that define the presentation of the gadget.
|
|
ExchangeWebServices.gadget\help\
|
Contains the Help.html file (which contains information about gadget settings and functionality) and its supporting files.
|
|
ExchangeWebServices.gadget\images\
|
Contains the image files that are used by the sample application.
|
|
ExchangeWebServices.gadget\include\
|
Contains the files that define the functionality of the gadget.
|
Now that you are familiar with the directory structure of the application, let's take a closer look at the files that live inside each of these folders.
ExchangeWebServices.gadget\
The ExchangeWebServices.gadget folder contains the files that define the presentation of the gadget, as described in the following table.
ExchangeWebServices.gadget\ files
|
File
|
Description
|
|---|
|
gadget.xml
|
Specifies how the gadget is displayed in the Windows Vista gadget gallery (gadget icon, gadget properties) and which HTML file is used to display the gadget.
|
|
ExchangeWebServices.html
|
Displays the main gadget view, showing the Inbox, Calendar, or Task items that are retrieved from Exchange 2007.
|
|
Flyout.html
|
Displays the fly-out window of the gadget (shown when a user clicks an Inbox, Calendar, or Task item that is displayed in the gadget).
|
|
Settings.html
|
Displays the Settings page that is used to configure the gadget.
|
ExchangeWebServices.gadget\help
The help folder contains the very informative Help.html file, which provides information about gadget functionality and configuration settings. Reading through this file is a great way to become familiar with the gadget.
ExchangeWebServices.gadget\images
As you might expect, the images folder contains the images that are used in the rendering of the gadget.
ExchangeWebServices.gadget\include
The include folder contains by far the most interesting files in the sample application — the ones that use Exchange Web Services to retrieve mailbox data from Exchange 2007 and then to display that data in the gadget. Let's take inventory of the files in this folder.
Include folder files
|
File
|
Description
|
|---|
|
Autodiscover.js
|
Contains functions that call the Autodiscover service and read the response to an Autodiscover request.
|
|
ExchangeWebServices.css
|
The style sheet that is used for the presentation of the main gadget view and the fly-out window.
|
|
ExchangeWebServices.js
|
Provides key functions that are used throughout the application to interact with Exchange Web Services and update gadget contents. Contains functions to do the following:
-
Manage gadget state (initialize, reset).
-
Manage timer and update gadget contents at set intervals.
-
Form the Exchange Web Services URL and Outlook Web Access URL.
-
Execute an Exchange Web Services request.
-
Get and set gadget connection property values.
-
Switch gadget view between folders (Inbox, Calendar, Tasks).
-
Open current folder in Outlook Web Access.
-
Manage gadget size and appearance in a docked or undocked state.
-
Manage visibility of the fly-out window.
-
Refresh gadget contents when the Settings page is closed.
-
Perform data conversion, mapping, and formatting.
|
|
Flyout.js
|
Provides the functionality in the fly-out window of the gadget. Contains functions to do the following:
-
Retrieve the specified item from the Exchange server.
-
Display the item in the fly-out window.
-
Update the item to mark it as read or unread.
-
Delete the specified item.
-
Open the specified item in Outlook Web Access.
|
|
Settings.css
|
The style sheet that is used for the presentation of the gadget Settings page.
|
|
Settings.js
|
Provides all the functionality in the Settings page of the gadget. Contains functions to do the following:
-
Open the Help.html file.
-
Display current gadget settings when the Settings page is opened.
-
Save gadget settings when the Settings page is closed.
|
|
Tiles.js
|
Works closely with ExchangeWebServices.js to provide functionality in the main gadget view. Contains functions to do the following:
-
Form the FindItem request.
-
Read the response to the FindItem request and update gadget contents accordingly.
-
Determine the CSS styles that are used for display based on whether the gadget is docked or undocked.
-
Move between item pages.
-
Generate HTML to display items, paging controls, and calendar summary zone.
-
Determine the unread mail count by using a GetFolder request.
|