Stage Service writes to wrong folder

12-20-2019 06:59 AM
Occasional Contributor II

The ArcGIS Pro Stage Service example ( works, but it writes to Hosted folder??

# Share to portal
print("Uploading Service Definition...")
arcpy.UploadServiceDefinition_server(sd_output_filename, "My Hosted Services")

I modified the following code from  "My Hosted Services" to "Maps".

The .sd file is published to the "Hosted" folder NOT the "Maps" folder??

How do I set the Folder to Maps??

Appreciate any assistance.



0 Kudos
4 Replies
Occasional Contributor

From taking a quick glance, you need to be looking at the "Upload Service Definition" tool's parameters:

Upload Service Definition—Help | ArcGIS Desktop 

You changed the in_server parameter which describes the server type. I would go read the info for that parameter and see which best fits your needs. 

To get it to save in a different folder you have to set the "in_folder_type" parameter to "NEW" then specify the folder with the "in_folder" parameter. It is by default set to "IN_SERVICE_DEFINITION" which means it gets its folder location from the service definition. 

So the block of code that uploads the service definition might look something like this:

arcpy.UploadServiceDefinition_server(in_sd_file = sd_output_filename,
                                     in_server = "My Hosted Services",
                                     in_folder_type = "NEW",
                                     in_folder = "Maps")

I haven't tested this so you're probably going to have to play around with it some to get it working

Hope this helps.

0 Kudos
Occasional Contributor II

Hi Jeremy,

Thanks for the response.

I am using the following:

                                     in_folder_type = "EXSISTING",
                                     in_folder = "Maps"

As I am trying to upload the Service to an existing folder called Maps.

The Service gets uploaded to a new Folder called "Hosted", not to an existing Folder called "Maps"

I don't understand why it is not working as expected ie uploaded to Maps??



PS I won't have access to ArcGIS Server till 06th January.



0 Kudos
Occasional Contributor

Can you please post your entire code so we can see it. Make sure to scrub out any sensitive information like server connections or account information. You can add your code by clicking the 3 dots that will say "Expand Toolbar" when you hover over the dots. Then click on "More" then on "Syntax Highlighter". When the Syntax Highlighter opens choose "Python" from the drop down menu at the top and paste your code in the main window.

0 Kudos
New Contributor III

Hey i'm trying to publish a webmap from Arcgis pro to Online...

I keep getting this error message :

ExecuteError: Failed to execute. The parameters are not valid. ERROR 000732: Server: The My Hosted Services dataset does not exist or is not supported Failed to execute (UploadServiceDefinition).

Thank you for help 
0 Kudos