<?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 List all distributed collaborations in AGOL in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356188#M69324</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am an admin to our AGOL and I am trying to create a report including list of all collaboration we have in our AGOL.&amp;nbsp; This is not included in the built in Report feature in AGOL.&lt;/P&gt;&lt;P&gt;I am using notebook (script provided to me before) in Pro to generate my other reports both for AGOL and enterprise (list of groups, users. etc.) but I don't have a script to generate list of all our distributed collaboration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me on this please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;*****************************************&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;gis = GIS("pro")&lt;/P&gt;&lt;P&gt;import time&lt;BR /&gt;# convert Unix epoch time to local time&lt;/P&gt;&lt;P&gt;def format_creation_time(obj):&lt;BR /&gt;create_time_raw = time.localtime(obj.created/1000)&lt;BR /&gt;create_time_formatted = "{}/{}/{}".format(create_time_raw[0], create_time_raw[1], create_time_raw[2])&lt;BR /&gt;return create_time_formatted&lt;/P&gt;&lt;P&gt;def format_lastlogin_time(obj):&lt;BR /&gt;lastlog_time_raw = time.localtime(obj.lastLogin/1000)&lt;BR /&gt;lastlog_time_formatted = "{}/{}/{}".format(lastlog_time_raw[0], lastlog_time_raw[1], lastlog_time_raw[2])&lt;BR /&gt;return lastlog_time_formatted&lt;/P&gt;&lt;P&gt;def format_lastmodified_time(obj):&lt;BR /&gt;lastmod_time_raw = time.localtime(obj.modified/1000)&lt;BR /&gt;lastmod_time_formatted = "{}/{}/{}".format(lastmod_time_raw[0], lastmod_time_raw[1], lastmod_time_raw[2])&lt;BR /&gt;return lastmod_time_formatted&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;Thanks in advanced!&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2023 04:26:49 GMT</pubDate>
    <dc:creator>KikSiops</dc:creator>
    <dc:date>2023-12-04T04:26:49Z</dc:date>
    <item>
      <title>List all distributed collaborations in AGOL</title>
      <link>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356188#M69324</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am an admin to our AGOL and I am trying to create a report including list of all collaboration we have in our AGOL.&amp;nbsp; This is not included in the built in Report feature in AGOL.&lt;/P&gt;&lt;P&gt;I am using notebook (script provided to me before) in Pro to generate my other reports both for AGOL and enterprise (list of groups, users. etc.) but I don't have a script to generate list of all our distributed collaboration.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me on this please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;*****************************************&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;gis = GIS("pro")&lt;/P&gt;&lt;P&gt;import time&lt;BR /&gt;# convert Unix epoch time to local time&lt;/P&gt;&lt;P&gt;def format_creation_time(obj):&lt;BR /&gt;create_time_raw = time.localtime(obj.created/1000)&lt;BR /&gt;create_time_formatted = "{}/{}/{}".format(create_time_raw[0], create_time_raw[1], create_time_raw[2])&lt;BR /&gt;return create_time_formatted&lt;/P&gt;&lt;P&gt;def format_lastlogin_time(obj):&lt;BR /&gt;lastlog_time_raw = time.localtime(obj.lastLogin/1000)&lt;BR /&gt;lastlog_time_formatted = "{}/{}/{}".format(lastlog_time_raw[0], lastlog_time_raw[1], lastlog_time_raw[2])&lt;BR /&gt;return lastlog_time_formatted&lt;/P&gt;&lt;P&gt;def format_lastmodified_time(obj):&lt;BR /&gt;lastmod_time_raw = time.localtime(obj.modified/1000)&lt;BR /&gt;lastmod_time_formatted = "{}/{}/{}".format(lastmod_time_raw[0], lastmod_time_raw[1], lastmod_time_raw[2])&lt;BR /&gt;return lastmod_time_formatted&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;Thanks in advanced!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 04:26:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356188#M69324</guid>
      <dc:creator>KikSiops</dc:creator>
      <dc:date>2023-12-04T04:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: List all distributed collaborations in AGOL</title>
      <link>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356376#M69325</link>
      <description>&lt;P&gt;Does this work for you? Adapted from &lt;A href="https://developers.arcgis.com/python/guide/building-distributed-gis-through-collaborations/#shortcut-to-establish-collaborations-in-a-single-step&amp;nbsp;" target="_self"&gt;this documentation&lt;/A&gt;:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for collab in gis.admin.collaborations.list():
    print(collab.name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 16:21:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356376#M69325</guid>
      <dc:creator>rwrenner_esri</dc:creator>
      <dc:date>2023-12-04T16:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: List all distributed collaborations in AGOL</title>
      <link>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356683#M69330</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/45954"&gt;@rwrenner_esri&lt;/a&gt;&amp;nbsp;. That works. I also needed additional details so I added these:&lt;/P&gt;&lt;P&gt;for collab in gis.admin.collaborations.list():&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;print(f" Name: {collab.name}"),&lt;BR /&gt;print(f" Description: {collab.description}"),&lt;BR /&gt;print(f" Created: {collab.created}"),&lt;BR /&gt;print(f" Last Modified: {collab.modified}\n")&lt;/P&gt;&lt;P&gt;- I have an output but don't know how to export it to csv, can you assist me please?&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 05:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356683#M69330</guid>
      <dc:creator>KikSiops</dc:creator>
      <dc:date>2023-12-05T05:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: List all distributed collaborations in AGOL</title>
      <link>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356934#M69333</link>
      <description>&lt;P&gt;Glad that works! Below is code which incorporates the addition details into a dataframe then exports it to csv from within ArcGIS Pro.&lt;/P&gt;&lt;P&gt;Just be sure to change the csv export file path on the final line.&lt;/P&gt;&lt;P&gt;-Rylee&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#imports, authentication
import pandas as pd
from arcgis.gis import GIS
gis = GIS("pro")

#create empty list 
collab_details = []

#loop through collaboration to add each to list
for collab in gis.admin.collaborations.list():
    collab_details.append("{},{},{},{}".format(collab.name, collab.description, collab.created, collab.modified))

#add all details to single column, comma separated
df = pd.DataFrame(collab_details, columns = ["to_split"]) 
df

#split column into multiple columns &amp;amp; rename
df[['Name', 'Description', 'Type', 'Modified']] = df['to_split'].str.split(',', expand=True)

#export to csv file in specified folder - replace with your url
df.to_csv("C:/Users/..../Documents/ArcGIS/Projects/CollaborationList.csv", columns=['Name', 'Description', 'Type', 'Modified'])&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 05 Dec 2023 17:22:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/list-all-distributed-collaborations-in-agol/m-p/1356934#M69333</guid>
      <dc:creator>rwrenner_esri</dc:creator>
      <dc:date>2023-12-05T17:22:27Z</dc:date>
    </item>
  </channel>
</rss>

