Create multiple service definition files (.sd) form multiple mxd files

952
4
Jump to solution
02-12-2017 10:49 PM
AhmadSALEH1
Occasional Contributor III

Hi

I wonder if anyone has a tool or a method that creates service definition files form a folder that contains multiple mxd files.

In my case I have a folder that has 76 mxds and I want to create 76 sd files in another folder from the existing mxd.

 

 

Thanks,

Ahmad Saleh

0 Kudos
1 Solution

Accepted Solutions
JonathanQuinn
Esri Frequent Contributor

There are a few samples on the help site for scripting publishing using Python.  The general idea is that you would use a for loop with the list of contents of the folder using os.listdir, figure out which are .mxds, and use Stage Service and Upload Service Definition to publish them.  You can use the name of the mxd for the name of the service.

View solution in original post

4 Replies
JayantaPoddar
MVP Esteemed Contributor

Although I haven't tried this out, CreateMapSDDraft - ArcPy

You might create a list to do it for every MXD in a particular workspace.



Think Location
AhmadSALEH1
Occasional Contributor III

Thanks Jayanta,

I have tried this before, the main issue with it the code is name dependent, for every sd that you need to create you should add the service name and workspace! I want a smarter tool or code that iterates all mxd in the file and create sd file.

In the link that you provided I should copy every mxd name to the code.

 

 

Thanks,

Ahmad Saleh

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

Maybe we should wait for a response from our Python experts to tweak the CreateMapSDDraft (adding wildcards maybe) alongwith the addition of Stage Service tool.



Think Location
JonathanQuinn
Esri Frequent Contributor

There are a few samples on the help site for scripting publishing using Python.  The general idea is that you would use a for loop with the list of contents of the folder using os.listdir, figure out which are .mxds, and use Stage Service and Upload Service Definition to publish them.  You can use the name of the mxd for the name of the service.