Adding VersionManagmentServer to .sddraft file before publishing to enterprise portal

307
0
07-27-2022 10:49 AM
TravysBaker
New Contributor II

Hello all,

My department is working on publishing many individual branch versioned feature classes to our enterprise portal. We've got just about everything working, including adding capabilities to the FeatureServer, but adding the "VersionManagmentServer" to our .sddraft isnt working at all.

The code snippets we've found on ESRI's help for creating an .sddraft show finding the VersionManagmentServer already existing within the .sddraft XML file and simply enabling it. Looking at our finished sddraft file though the only existing typename is FeatureServer with VersionManagmentServer nowhere to be found in order to just enable it.  A copy of that .ssdraft file has been attached to this post.

Is there a way to create the "VersionManagementServer" within the .ssdraft file during this process so we can then enable it before writing out the .ssdraft? 

Here's an example of what we've managed to put together so far from other examples. All this function does is enable already preexisting TypeNames, which doesn't work  for us because "VersionManagementServer" (or any others besides FeatureServer) aren't there to enable in the first place. 

def enable_extensions(sddraftPath, soe):
"""Function to enable extensions"""
    # Read the .sddraft file
    doc = DOM.parse(sddraftPath)

    # Find all elements named TypeName
    # This is where the additional layers and capabilities are defined
    typeNames = doc.getElementsByTagName('TypeName')
    for typeName in typeNames:
        # Get the TypeName to enable
        if typeName.firstChild.data == soe:
            extension = typeName.parentNode
            for extElement in extension.childNodes:
                # Enable feature access
                if extElement.tagName == 'Enabled':
                    extElement.firstChild.data = 'true'

    # Write to the .sddraft file
    f = open(sddraftPath, 'w')
    doc.writexml(f)
    f.close()

 

 Any ideas?

0 Kudos
0 Replies