Hosting Other Web Content in the Project Guide

At heart, the Project Guide isn't side panes or scripts. It's Microsoft® Internet Explorer. The Project Guide orders Microsoft Office Project to replace its document window with an Internet Explorer window. Internet Explorer can host the Project Guide main page and side pane, and it can also host any other local or trusted Web content within Project. That's where Application.LoadWebBrowserControl comes in.

LoadWebBrowserControl can bring up Internet Explorer with content that's not in the Project Guide content schema. It makes certain that Project has created an instance of an Internet Explorer window, and then sends the main page an Application.LoadWebPage event with orders to load a target page. When the Project Guide is running, there's already an Internet Explorer window available, so LoadWebBrowserControl sends the LoadWebPage event to the Project Guide main page. If the Project Guide is off, then LoadWebBrowserControl creates an instance of the Internet Explorer window and sets the main page to the wrapperPage parameter value.

LoadWebBrowserControl doesn't actually navigate the Internet Explorer window to the target page; the main page does the navigation, regardless of whether that's the Project Guide main page or a LoadWebBrowserControlwrapperPage. LoadWebBrowserControl passes the targetPage parameter to the main page in a LoadWebPage event. The main page translates targetPage into a URL and orders Internet Explorer to navigate there. That means every main page needs to handle LoadWebPage, whether the main page is for the Project Guide or a wrapperPage. That also means a set of Project Guide pages can have several different LoadWebPage event handlers, each of which has to interpret targetPage values consistently.

The wrapper.htm page is the default main page for calls to LoadWebBrowserControl. The wrapper.htm page uses functions in mainpage.js and wrapper.js to translate the targetPage parameter into a URL. This eliminates the need for URL validation on targetPage values. LoadWebBrowserControl then uses the URL to load the page. In the default wrapper.htm page, all of the targetPage values translate into Project Server pages.

The following table lists the default targetPage values and the Project Server pages that get loaded as a result.

targetPage value Project Server page

1

Updates

2

Document Library for the active project

3

Issues for the active project

4

Project Center

5

Resource Center

6

Portfolio Analyzer

7

Portfolio Modeler

8

Risks for the active project

Even when the Project Guide is visible, you can still set the right pane directly to another target URL. That's how the Project Guide brings up Project Server pages in the Add Documents side pane.

Note  To see this for yourself, you must have Project Professional set up correctly to use Project Server.

When you're finished with the Web page, call Application.UnloadWebBrowserControl to clean up. UnloadWebBrowserControl always navigates back to the view that was shown before LoadWebBrowserControl was called. If the Project Guide is not visible, UnloadWebBrowserControl also removes the Internet Explorer window and replaces it with a Project document window. It's useful to attach an UnloadWebBrowserControl call to a button in the LoadWebBrowserControlwrapperPage so users can readily see how to get back to their regular view.

Integrating the Internet Explorer Web browser control into Project has a few other side effects. Project lets Internet Explorer handle Cut, Paste, Copy, and Print operations in the Internet Explorer window. When the focus is in the Project view control, you see the expected result with a Copy or Print command. It generally does not work to print a side pane next to a Project view control, because the side pane is a frame in an Internet Explorer window. That should not be a problem, but be aware that Internet Explorer is in charge of Web browser Cut, Copy, Paste, and Print operations.

To summarize, you can use LoadWebBrowserControl to put any trusted or local Web page into a Project view. Use UnloadWebBrowserControl to remove that page and restore the previous view. These two Project object model methods work whether the Project Guide is turned on or off. They're especially useful when integrating Web services such as from Project Server within the Project application.

For more information, see Custom Views and the LoadWebBrowserControl Method.