Moving a Hosted Feature Layer to a Named Folder in Portal using Python

366
1
11-02-2022 01:10 PM
NateRogers1
New Contributor

I have a python script which downloads a .CSV from the internet, dyn segs the mile markers, creates a feature class, then uploads it to our portal environment and the script runs great and as expected. The issue is that the script takes the feature class and uploads it as a hosted feature layer into our root folder in Portal. I want to be able to put this hosted feature class into a named folder that already exists in our Portal environment using python. Thanks!

0 Kudos
1 Reply
Clubdebambos
Occasional Contributor III

Hi @NateRogers1 

Im going to make an assumption that you are using ArcPy and the arcpy.UploadServiceDefinition_server() function, there is an in_folder parameter you can use.

arcpy.UploadServiceDefinition_server(sd_output_filename, server_url, in_folder_type="EXISTING", in_folder="NAME OF FOLDER")

If my assumption is incorrect, you can share some code for assessment.

 

~ Mapping my way to retirement
0 Kudos