I would need to automate publishing my mxd to ArcGIS Online as a publicly-accessible feature service. So it will be shared by everyone. I am with ArcGIS 10.1 so I cannot use the MXDToWebMap_server tool as it is only available to ArcGIS 10.3 and above.
I am able to get most of the automation done by following the help document:
ArcGIS Help 10.1 to run the following tools in the correct order
The problem I came across is, the feature service is replaced and the Share properties are changed to prvivate even if I manually set up Shared with Everyone.
The help document does not specify whether and how we can set up the Share properties in the sd file before uploading.
I did find there are a whole bunch of parameters for the arcpy.UploadServiceDefinition_server tool:
UploadServiceDefinition_server (in_sd_file, in_server, {in_service_name}, {in_cluster}, {in_folder_type}, {in_folder}, {in_startupType}, {in_override}, {in_my_contents}, {in_public}, {in_organization}, {in_groups})
I am assuming the {in_public} param is the one I need to use. But I would prefer a working example of use of those parameters in the context of publishing to ArcGIS Online (i.e. 'My Hosted Services').
Did you ever find a solution to your problem? I'm having the same issue. I'd love to see an example of someone using the `in_public` parameter successfully.
I'm using:
in_public='PUBLIC'
This still sets my service to private.
I was having same issue.
Trying to schedule overwriting a service on ArcGIS Online, script being triggered from a machine running ArcGIS Pro 2.3
The following works for me.
Make sure you include the in_override parameter.
arcpy.UploadServiceDefinition_server(sd_output_filename, "My Hosted Services", in_override="OVERRIDE_DEFINITION", in_public="PUBLIC")
Thank you, I have no idea why this works but it does
Thanks it works, I had the same problem with arcgis pro 2.6.0 and portal 10.7