<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Find map service data source in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/find-map-service-data-source/m-p/1220908#M7883</link>
    <description>&lt;P&gt;I need to be able to find the data source of all referenced map services within Portal. I have written a script to do this, however it feels unnecessarily clunky, does anyone know whether there is a better, simpler way to achieve this? For image services, this path information is easily located within the service properties, I cannot seem to find this equivelant information for map services (just the .msd is there which isn't helpful).&lt;/P&gt;&lt;P&gt;In an ideal world I would update all the source data paths as we've had a DFS change, but editing the manifest.json seems wrought with danger. A less hacky way would be hugely helpful!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pathlib import Path
import json

gis = GIS("URL")
servers = gis.admin.servers
for server in servers.list():
    serviceManager = server.services
    folders = serviceManager.folders

    for folder in folders:
        services = serviceManager.list(folder=folder)
        for service in services:
            properties_dict = service.properties["properties"]
            if service.properties.portalProperties.portalItems[0].type == 'MapServer':
                # create new path string to the manifest.json
                filepath = properties_dict['filePath']
                parts = Path(filepath).parts
                new_path = str(Path(*parts[:parts.index('extracted')+1 / 'manifest.json')
                with open(new_path, 'r') as f:
                    data = json.load(f)
                path = []
                for db in data['databases']:
                    path.append(db['onServerConnectionString'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 21:47:24 GMT</pubDate>
    <dc:creator>JessicaRouns</dc:creator>
    <dc:date>2022-10-11T21:47:24Z</dc:date>
    <item>
      <title>Find map service data source</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/find-map-service-data-source/m-p/1220908#M7883</link>
      <description>&lt;P&gt;I need to be able to find the data source of all referenced map services within Portal. I have written a script to do this, however it feels unnecessarily clunky, does anyone know whether there is a better, simpler way to achieve this? For image services, this path information is easily located within the service properties, I cannot seem to find this equivelant information for map services (just the .msd is there which isn't helpful).&lt;/P&gt;&lt;P&gt;In an ideal world I would update all the source data paths as we've had a DFS change, but editing the manifest.json seems wrought with danger. A less hacky way would be hugely helpful!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from pathlib import Path
import json

gis = GIS("URL")
servers = gis.admin.servers
for server in servers.list():
    serviceManager = server.services
    folders = serviceManager.folders

    for folder in folders:
        services = serviceManager.list(folder=folder)
        for service in services:
            properties_dict = service.properties["properties"]
            if service.properties.portalProperties.portalItems[0].type == 'MapServer':
                # create new path string to the manifest.json
                filepath = properties_dict['filePath']
                parts = Path(filepath).parts
                new_path = str(Path(*parts[:parts.index('extracted')+1 / 'manifest.json')
                with open(new_path, 'r') as f:
                    data = json.load(f)
                path = []
                for db in data['databases']:
                    path.append(db['onServerConnectionString'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 21:47:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/find-map-service-data-source/m-p/1220908#M7883</guid>
      <dc:creator>JessicaRouns</dc:creator>
      <dc:date>2022-10-11T21:47:24Z</dc:date>
    </item>
  </channel>
</rss>

