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

IMapServerObjects.RefreshServerObjects Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMapServerObjects Interface > IMapServerObjects.RefreshServerObjects Method
ArcGIS Developer Help

IMapServerObjects.RefreshServerObjects Method

Updates the server info based on the current state of the underlying fine-grained objects.

[Visual Basic .NET]
Public Sub RefreshServerObjects ( _
public void RefreshServerObjects (
HRESULT RefreshServerObjects(

Product Availability

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


Use RefreshServerObjects when you have made changes to the fine-grained ArcObjects and want to apply them to the MapServer object. Keep in mind that this will change the default state of the MapServer object. In order to get the updated MapDescription, you have to call GetServerInfo on IMapServer2 again.

Any custom graphics (IMapDescription2 or IPageDescription) set previous to the RefreshServerObjects call will be lost. You will need to repeat the code for the custom graphics.

RefreshServerObjects does not refresh the extent on IPageDescription . Therefore, if you have zoomed to a particular extent of the page layout using the fine-grained ArcObjects (IActiveView) and you want to apply this extent to the PageDescription, you have to do this manually.


The following sample code shows how to change the fine-grained ArcObjects (by adding a new group layer), and apply these changes to the MapServer object using RefreshServerObjects. It assumes that you are developing an ArcGIS for Server application using a ServerContext, and already have a valid ServerContext, MapServer and MapDescription object.

IServerContext serverContext;
IMapServer2 mapServer;
IMapDescription mapDesc;
// Access fine-grained ArcObjects
IMapServerObjects2 mapServerObj = (IMapServerObjects)mapServer;
string strMapName = mapServer.DefaultMapName;
IMap map = mapServerObj.get_Map(strMapName);

// Add a new group layer to map
IGroupLayer groupLayer = serverContext.CreateObject("esriCarto.GroupLayer") as IGroupLayer;
groupLayer.Name = "New Group Layer";

// Apply changes to MapServer object

// Get updated MapServerInfo and MapDescription
IMapServerInfo2 mapServerInfo = mapServer.GetServerInfo(strMapName);
mapDesc = mapServerInfo.DefaultMapDescription

See Also

IMapServerObjects Interface