HOW TO

Generate a report of all items in Portal for ArcGIS and ArcGIS Online

Last Published: August 30, 2022

Summary

In an organization, managing and administrating large number of items stored within Portal for ArcGIS and ArcGIS Online can be time-consuming. To simplify this process using ArcGIS API for Python, the following steps describe how to generate a report of all items in Portal for ArcGIS or an ArcGIS Online organization.

Procedure

Choose one of the following scripts below.

Generate the report for all items in Portal for ArcGIS

  1. Import the necessary modules.
from arcgis import GIS
import pandas as pd
  1. Connect to the portal URL and specify the credentials.
gis = GIS('<machine>.<domain>/<web adaptor name>', 'username', 'password', verify_cert=False)
print("Connected")
  1. Search for all items available in the portal.
content_list = gis.content.search('owner:<Owner_Name>', max_items=-1)
  1. Create a dictionary containing all the items with the details such as title, type, owner, and id.
out_dict = {}
for item in content_list:

    out_dict[content_list.index(item)] = [item.title, item.type, item.numViews, item.owner, item.id]

df = pd.DataFrame.from_dict(out_dict, orient='index')
df.rename(columns={0:'title', 1:'type', 2:'views', 3:'owner', 4:'id'}, inplace=True)
  1. Export the dictionary to a table file such as .csv or .xls.
df.to_csv(r'<Folder Location>')

The following code block demonstrates the full script.

from arcgis import GIS
import pandas as pd

gis = GIS('machines.esri.com/portal', 'username', 'password', verify_cert=False)
print("Connected")

content_list = gis.content.search('owner:Test_User', max_items=-1)

type, owner, id, etc.
out_dict = {}
for item in content_list:

    out_dict[content_list.index(item)] = [item.title, item.type, item.numViews, item.owner, item.id]

df = pd.DataFrame.from_dict(out_dict, orient='index')
df.rename(columns={0:'title', 1:'type', 2:'views', 3:'owner', 4:'id'}, inplace=True)

df.to_csv(r'C:\Users\USER\Desktop\TestListReport.csv')

Generate the report for all items in ArcGIS Online

  1. Import the necessary modules.
from arcgis import GIS
import pandas as pd
  1. Connect to the portal URL and specify the credentials.
gis = GIS('https://arcgis.com', 'username', 'password')
print("Connected")
  1. Search for all items available in the portal.
content_list = gis.content.search('owner:username', max_items=-1)
  1. Create a dictionary containing all the items with the details such as title, type, owner, and id.
out_dict = {}
for item in content_list:

    out_dict[content_list.index(item)] = [item.title, item.type, item.numViews, item.owner, item.id]

df = pd.DataFrame.from_dict(out_dict, orient='index')
df.rename(columns={0:'title', 1:'type', 2:'views', 3:'owner', 4:'id'}, inplace=True)
  1. Export the dictionary to a table file such as .csv or .xls.
df.to_csv(r'<Folder Location>')

The following code block demonstrates the full script.

from arcgis import GIS
import pandas as pd

gis = GIS('https://arcgis.com', 'username', 'password')
print("Connected")

content_list = gis.content.search('owner:Test_User', max_items=-1)

out_dict = {}
for item in content_list:

    out_dict[content_list.index(item)] = [item.title, item.type, item.numViews, item.owner, item.id]

df = pd.DataFrame.from_dict(out_dict, orient='index')
df.rename(columns={0:'title', 1:'type', 2:'views', 3:'owner', 4:'id'}, inplace=True)

df.to_csv(r'C:\Users\USER\Desktop\TestListReport.csv')

Article ID: 000028142

Software:
  • ArcGIS Online
  • Portal for ArcGIS

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options