How do I publish to a specific folder on ArcGIS server

440
1
07-02-2020 10:12 AM
CarlTownsend
New Contributor

Hi I have a script that downloads tiff and then publishes to  our server. It works great except I can't seem to get it to publish to a specific folder on the server. For now I want it to publish to a folder we have called Test. The code runs, downloads the files and publishes to the root folder; it seems to ignore the Test folder I have setup.

For example here's a snippet:
# define local variables
wrkspc = 'C:/GIS/wildfire/'
mapDoc = arcpy.mapping.MapDocument(wrkspc + 'nrcan_fwi.mxd')
con = 'GIS Servers/arcgis DEV on xxxx-xxxx-xxxx_6443'
# Destination folder name on ArcGIS Server
serverFolder = 'Test'
# Name of map service
service = 'nrcan_fwi'
sddraft = wrkspc + service + serverFolder +'.sddraft'
sd = wrkspc + service + serverFolder +'.sd'
summary = 'Fire Weather Index'
tags = 'Wildfire, Fire Weather Index'

I think I'm missing something. Does anyone know what's wrong?

Thanks!

0 Kudos
1 Reply
CarlTownsend
New Contributor

Update: I got it working. For anyone else,  I updated:

analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER',
                                          con, True, None, summary, tags)

to

analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'ARCGIS_SERVER',
                                          con, True, serverFolder, summary, tags)