View list of ArcGIS Server Data Store Items

Recently I had a task where, for >10 ‘clients’, I had to:

  1. Create a unique database user
  2. Grant privileges to certain datasets in a SDE database
  3. Save an mxd showing only what was relevant to that client
  4. Publish a feature service for consumption in ArcGIS Online

While I will leave the specifics of that delightful script for another post, during debugging I came up against an error where the script would fail if the database connection had already been registered with ArcGIS Server.

In lines 15 and 16, I get the location of the ArcCatalog connections folder for the current user. This is dependent on knowing which version of Arc is installed. I have found a slightly better way (written quite verbosely for clarity):

ArcMap Woes Part 1: Random fail in ArcMap works in ArcCatalog

Today I tried to run a script in ArcMap. Nothing fancy, just exporting data driven pages as jpegs in a for loop (basically taken straight from the help docs 2 years ago, and used in endless variations since):

Of course, ArcMap crashes. No, not crashes, because then it would pop up the ESRI “Send Error Report” dialog box. It simply terminates. I run the same script in ArcCatalog and it works perfectly. Note that I have run scripts like this many times before in ArcMap without any issues. It’s almost as if ArcMap gets tired of certain things, and refuses to cooperate. I’m pretty sure if I try this script in ArcMap again in a few days time it will be fine.