Hi,
I'm trying to get the following code running. This code is a copy from this link:
CreateSharingDraft—Sharing module | ArcGIS Desktop
import arcpy
import os
outdir = r"C:\Project\Output"
service = "MapServiceDraftExample"
sddraft_filename = service + ".sddraft"
sddraft_output_filename = os.path.join(outdir, sddraft_filename)
aprx = arcpy.mp.ArcGISProject(r"C:\Project\World.aprx")
m = aprx.listMaps("World")[0]
service_draft = arcpy.sharing.CreateSharingDraft("STANDALONE_SERVER", "MAP_SERVICE", service, m)
service_draft.targetServer = r"C:\Project\myserver.ags.esri.com (publisher).ags"
service_draft.exportToSDDraft(sddraft_output_filename)
sd_filename = service + ".sd"
sd_output_filename = os.path.join(outdir, sd_filename)
arcpy.StageService_server(sddraft_output_filename, sd_output_filename)
print("Uploading Service Definition...")
arcpy.UploadServiceDefinition_server(sd_output_filename, r"C:\Project\myserver.ags.esri.com (publisher).ags")
print("Successfully Uploaded service.")
I've changed the variable accordingly, however I get this error even though I can connect to the server (.ags) in ArcGIS Pro:
Are there any other options besides "STANDALONE_SERVER" in
service_draft = arcpy.sharing.CreateSharingDraft("STANDALONE_SERVER", "MAP_SERVICE", service, m)?
Thanks.