Frequently asked question

How to programmatically identify the version creation option set for all sync-enabled feature services

Last Published: April 15, 2024

Answer

When sharing data to ArcGIS Enterprise as a referenced feature layer for offline use by enabling the sync capability from ArcGIS Pro, users have the following options to specify the version creation behavior, as shown in the next image:

  • Create a version for each downloaded map
  • Create a version for each user
  • None

2024-04-08_16-30-42.png

The version creation option determines whether or not a new version will be created whenever the data is taken offline. 

In some cases, a user may want to get a report on what version creation option has been set for each of the published services in the ArcGIS Enterprise deployment. Using the ArcGIS API for Python we can iterate over the services published to a server and get the current syncVersionCreationRule property value for each feature service. The syncVersionCreationRule indicates what version creation option has been configured for the published service. 

The below sample script can be used to print the syncVersionCreationRule property for each service in ArcGIS Enterprise:

  from arcgis.gis import GIS  

gis = GIS("https://machine.domain/webadaptor", "userName", "password")
gis_servers = gis.admin.servers.list()
server = gis_servers[0]
services = server.services.list(folder='/')
for service in services:
serviceUrl = service.url
serviceName = service.properties.serviceName
for extension in service.extensions:
if extension.typeName == 'FeatureServer':
properties = extension.properties
if 'syncVersionCreationRule' in properties.keys():
syncVersionCreationRule = properties['syncVersionCreationRule']
print("Version create option for {0} is: {1}".format(serviceName, syncVersionCreationRule))

The script can be run by copying and pasting the sample code into a Python IDE such as PyCharm or a new Notebook in ArcGIS Pro. An example Notebook is shown in the next image.

Details on how to create a Notebook in ArcGIS Pro can be found in this reference: Notebooks in ArcGIS Pro

Example script in Notebook returns results such as: Version create option for TESTARCHIVE is: versionPerDownloadedMap, and Version create option for Water_Distribution_Simple_Network is: none

Article ID:000032168

Software:
  • ArcGIS Pro
  • ArcGIS API for Python
  • ArcGIS Enterprise

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic