Select to view content in your preferred language

How do I search all content in my portal using gis.content.search?

2861
3
Jump to solution
04-17-2018 12:38 PM
GajananBalasubramaniam1
Occasional Contributor

How can this be done? I want to be able to search all contents (layers, collection, service, maps, apps .,ect) found in my Portal. 

1 Solution

Accepted Solutions
SethLewis1
Frequent Contributor
#import modules
from arcgis.gis import *
from IPython.display import display

#declare a connection to your portal
gis = GIS("portal URL", "user", "pass")
print("Successfully logged in as: " + gis.properties.user.username)

#search for items without passing in string values to the query or type parameters
items = gis.content.search('', '',)
for item in items:
  display(item)‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

3 Replies
SethLewis1
Frequent Contributor
#import modules
from arcgis.gis import *
from IPython.display import display

#declare a connection to your portal
gis = GIS("portal URL", "user", "pass")
print("Successfully logged in as: " + gis.properties.user.username)

#search for items without passing in string values to the query or type parameters
items = gis.content.search('', '',)
for item in items:
  display(item)‍‍‍‍‍‍‍‍‍‍‍‍
GajananBalasubramaniam1
Occasional Contributor

Perfect! Thank You!!

DanHuber
Occasional Contributor

Seth's answer is correct, but the gis.content.search() method only returns the first 10 items found.   You need to add the parameter "max_items=" and set the value greater than the number of items you have in your Portal.