I have a basic python script that takes a hosted feature service from ArcGIS Online and converts it to an excel (.xls) file. The only problem is, I need to sign-in to ArcGIS Online within ArcMap to get the script to run, since the feature service is only shared with my organization. Is there any way to store my credentials within the script so that it will run on a daily basis without me having to sign-in on ArcMap every time? Any help is greatly appreciated. Thank you!
Solved! Go to Solution.
I would have to take a look at the service to see what's going on. If you want, you can share the service to a group in AGOL and invite my user account (jskinner_CountySandbox) to it.
Ok, thanks. I have invited you to a group to check out the service. When I remove the code below from the script, the script will run and it downloads the attachments and puts them in a folder, but the GlobalID_Str field is empty as well as the entire attachment table created is empty.
for key in dict:
with arcpy.da.UpdateCursor(fc, [OID, "GlobalID_Str"], OID + " = " + str(key)) as cursor:
for row in cursor:
row[1] = dict[key]
cursor.updateRow(row)
You OBJECTID field in AGOL is OBJECTID_1, but when you download the data it's converted back to OBJECTID.
You can change the code to fix this. Open the .py file in a text editor and under line 340 add the following:
OID = "OBJECTID"
Ex:
Is there anyway to specify the output name of the file where the attachments are stored? Right now each image is being output as a separate folders using a variation of the GlobalID for a name. I'd like to have it output with just the file name. Thanks!
The folder with the global id name is needed in order to successfully join the attachments to the feature class.