AnsweredAssumed Answered

Enable Sync capability on a read-only feature service with Python

Question asked by gbs522 on Aug 9, 2016
Latest reply on Aug 18, 2016 by gbs522

I have written a Python script tool that publishes map services for my organization. It works great, except that I am trying to publish read-only feature services with the "Sync" capability for offline mobile use. After following examples from Esri/other forums, I set the capabilities in my script by parsing the service definition draft as an xml document, as shown here:


# turn on feature access if service is editable
if service.endswith("Editable") or service.endswith("Redlining") or allowSync:

  featAccessSettings = doc.getElementsByTagName("TypeName")

   for featAccessSetting in featAccessSettings:

   if == "FeatureServer":

  featAccessSetting.parentNode.getElementsByTagName("Enabled")[0] = "true"
   configProps = doc.getElementsByTagName("Info")[0]

  propArray = configProps.firstChild

  propSets = propArray.childNodes

   for propSet in propSets:

  keyValues = propSet.childNodes

   for keyValue in keyValues:

   if keyValue.tagName == "Key":

   if == "WebCapabilities":

   if (service.endswith("Editable")) or (service.endswith("Redlining")): == "Query,Create,Update,Delete,Uploads,Editing"
   else: == "Query,Sync"



On the last line, to create a read-only feature service (according to this guide: Prepare data for offline use—Documentation | ArcGIS for Server ), I set the web capabilities to only Query and Sync, but when the tool completes running, the publish service still has full editing capabilities and Sync disabled. If I try to publish the service with the user interface inside ArcMap or ArcCatalog, the web capability settings come across correctly.


Is there another parameter that needs to be set programmatically, that I am missing here? I know the data has to be configured correctly to use Sync, but again, the data I've been testing with works fine when published though the UI.