Using these resources:
http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/createmapsddraft.htm
https://community.esri.com/thread/139716
I have a script that is able to successfully publish my MXD to a service. The only issue is when I publish the service all feature access (create, delete, query, sync, update) is enabled. What I would like is only to have Query and Update enabled like shown in the screenshot below:
My code for that section is below, I can paste the entire code but the problem is entirely with this section (when I comment it out everything publishes fine but with all the feature access operations allowed)
# Turn on feature access capabilities
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 keyValue.firstChild.data == "WebCapabilities":
keyValue.nextSibling.firstChild.data = "Query,Update,Uploads,Editing"
I think it is probably just a syntax issue but I am not sure.
Has anyone done anything like this and if so what was your solution?
I found this page https://community.esri.com/thread/181211 which says that the proper index is [7] instead of [0] so I updated my code to this
configProps = doc.getElementsByTagName('Info')[7]
propArray = configProps.firstChild
propSets = propArray.childNodes
for propSet in propSets:
keyValues = propSet.childNodes
for keyValue in keyValues:
if keyValue.tagName == 'Key':
if keyValue.firstChild.data == "WebCapabilities":
keyValue.nextSibling.firstChild.data = "Query,Update,Editing"
Now the script does not error out when it publishes but it is still publishing with CREATE and DELETE still enabled.