ListMapServices

Summary

Lists the names of map services for a designated ArcGIS Server.

Discussion

In order to connect to the ArcGIS Server you need to supply both the server URL (connection_url_or_name) and the server host name (server). If you are connecting to a UNIX/Linux server you will also need to supply authentication information. This includes a username (connection_username), password (connection_password), and domain (connection_domain). If you are not publishing to a UNIX/Linux server you do not need to supply this information since authentication information is provided by the operating system.

If map services belong to a folder, the folder name will be part of the returned map service name (e.g., MapFolder1/MapService1). If you want to use just the map service name you will need to parse out the folder name.

Syntax

ListMapServices (connection_url_or_name, server, {connection_username}, {connection_password}, {connection_domain})
ParameterExplanationData Type
connection_url_or_name

A string that represents the URL of the ArcGIS server to which you want to get a list of services.

String
server

A string that represetnts the ArcGIS server host name.

String
connection_username

A string that represents a user name used to connect to the ArcGIS server. In order to get a list of map services this user name should be a member of the ArcGIS Server admin group. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(The default value is None)

String
connection_password

A string that represents a password used to connect to the ArcGIS server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(The default value is None)

String
connection_domain

A string that represents a domain name used to connect to the ArcGIS server. This variable is only necessary when connecting to a UNIX/Linux ArcGIS server.

(The default value is None)

String
Return Value
Data TypeExplanation
List

A Python list of map services.

Code Sample

ListMapServices example

This script lists all maps services for an ArcGIS Server named MyServer.

import arcpy
serviceList = arcpy.mapping.ListMapServices("http://bond/arcgis/services","bond")
for serviceName in serviceList:
    print serviceName

11/21/2011