DeleteMapService

Summary

Deletes a map service from a designated ArcGIS Server.

Discussion

You must be a member of the server's ArcGIS Server admin group in order to delete the map service.

This function can only be used with ArcGIS Server 10.0. You cannot delete map services from pre-10.0 servers.

There are two parts to this function: one part is information needed to connect to the ArcGIS Server while the other includes information on the service itself.

In order to the 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.

Syntax

DeleteMapService (connection_url_or_name, server, service_name, {folder_name}, {connection_username}, {connection_password}, {connection_domain})
ParameterExplanationData Type
connection_url_or_name

A string that represents the URL of the ArcGIS server for which you want to delete a service.

String
server

A string that represents the ArcGIS server host name.

String
service_name

A string that represents the name of the service. This is the name people will see and use to identify the service. The name can only contain alphanumeric characters and underscores. No spaces or special characters are allowed. The name cannot be more than 120 characters in length.

String
folder_name

A string that represents a folder name.

String
connection_username

A string that represents a user 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
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

Code Sample

DeleteMapService example:

This script deletes a map service named MyMapService from an ArcGIS Server named MyServer. MyMapService resides in a folder named MyFolder.

import arcpy
arcpy.mapping.DeleteMapService("http://<MyServer>/arcgis/services", "MyServer", "MyMapService", "MyFolder")


11/21/2011