This document is archived and information here might be outdated.  Recommended version.


IMapServerObjects2 Interface (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Carto)  

IMapServerObjects2 Interface

Provides access to core objects contained within the map document. Note: the IMapServerObjects2 interface has been superseded byIMapServerObjects2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use IMapServerObjects to access fine-grained ArcObjects. Through this interface you can access ILayer, IMap and IPageLayout. For example, you can make changes to the map, such as adding a new layer, using the IMap object.

This interface is not supported by optimized MapServer

Members

Description
Method ApplyMapDescription Applies the current state of the map description to the map server object.
Read-only property Layer The layer specified by the map name and layer ID. If the mapName is blank, the default map (active data frame) will be assumed.
Read-only property LayerID The layer specified by the map name and layer ID. If the mapName is blank, the default map (active data frame) will be assumed.
Read-only property Map The map corresponding to the specified map name. Pass in a blank string for mapName to get the default map (active data frame).
Read-only property PageLayout The page layout object for the current map document.
Method RefreshServerObjects Updates the server info based on the current state of the underlying fine-grained objects.
Read-only property Thumbnail The thumbnail stored in the map document.

CoClasses that implement IMapServerObjects2

CoClasses and Classes Description
MapServer The MapServer component provides programmatic access to the contents of a map document on disk, and creates images of the map contents based on user requests. Designed for use in building map-based web services and web applications.

Remarks

Though the methods and properties available through MapServer and its associated objects offer important mapping functionality, they cannot possibly encapsulate all that ArcObjects offers. In many cases you may want to use other, finer-grained, ArcObjects in conjunction with MapServer. You can do this using the IMapServerObjects2 interface. Through this interface you can access ILayer, IMap and IPageLayout. For example, you can make changes to the map, such as adding a new layer, using IMap.

It is very important to distinguish between temporary and permanent changes to the MapServer object. A temporary change would include changes to the MapDescription or LayerDescription using IMapDescription2 and ILayerDescription3. For example, you might change the geographic extent of a map (MapArea) or change the visibility of a layer (Visible). These changes can be temporary and valid for the duration of the call. Once the call has ended the MapServer object returns to it's default state.

Permanent changes to the MapServer object can be done in two ways.  The first is by changing MapServer properties using such interfaces as IMapDescription and ILayerDescription and then calling the IMapServerObjects method ApplyMapDescription. This will update the state of the MapServer object. Another way to change the MapServer object is to access the underlaying fine-grained ArcObjects directly using the methods on IMapServerObjects, make a change such as adding a new layer or changing a layer's rendering, and then calling RefreshServerObjects. This refreshes the MapServer object with the current state held by the fine-grained ArcObjects.

If the underlying fine-grained ArcObjects are to be changed, MapServer objects should be in a non-pooled configuration.