Coding in a Windowless Environment

SharePoint Designer Developer Reference

In Microsoft Office SharePoint Designer, it is possible to create a windowless environment to cut down on User Interface (UI) overhead, but there are some drawbacks to working in such an environment. For example, opening a page with the ViewMode property set to PageViewNoWindow, creates a windowless environment where window elements that require the UI will not work correctly. If you open a page without a window and try to access it using code such as PageWindow.Document.ParentWindow, the resulting code returns nothing instead of returning a DesignerWindow object. The following statements provide access to windowless pages.

Application.LocatePage(DocumentUrl As String, _
    ViewMode As PageViewMode) As PageWindow
Web.LocatePage(DocumentUrl As String, ViewMode As PageViewMode) _
    As PageWindow
File.Edit(ViewMode As PageViewMode) As PageWindow

The following table describes the PageWindow methods and properties and the objects or error messages they return. Some methods and properties of the PageWindow object are disabled in a windowless environment and will return the results shown in the following table.

Disabled Method or Property of the PageWindow Object Returned Object or Error Message
ActiveDocument Returns "object or with variable not set" error message.
ActiveFrameWindow Returns "object or with variable not set" error message.
Caption Returns the URL for the PageWindow object.
Document Returns a DesignerDocument object.
File Returns a File object.
ViewMode This property can not be set. It returns the constant PageViewNoWindow.
Visible Returns False.
Web Returns the Web object if the object was located using the following statements.
Web.LocatePage
File.Edit
ApplyTheme Returns a run-time error.
Close(ForceSave) Closes the page window.
Refresh(ForceSave) Refreshes the page window.
Save(ForceOverwrite) Saves the page window.
SaveAs(ForceOverwrite) Saves the page window to a new URL.