<?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 Re: Identify users outside partnered collaboration (groups) in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1632719#M65559</link>
    <description>&lt;P&gt;Get all users in the group then check their orgid against your or your partnered orgs. It should be available as a property.&lt;/P&gt;&lt;P&gt;Here's sample code from AI. I haven't tested it. Would definitely recommend reviewing it before removing users. Sometimes it can be tricky to get users or information when they are not in your org.&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;GROUP_ID = "your_group_id_here"&lt;BR /&gt;PARTNER_ORG_IDS = ["abc1234567890", "def987654321"]&lt;/P&gt;&lt;P&gt;my_org_id = gis.users.me.orgId&lt;BR /&gt;allowed_org_ids = [my_org_id] + PARTNER_ORG_IDS&lt;/P&gt;&lt;P&gt;group = gis.groups.get(GROUP_ID)&lt;BR /&gt;group_members = group.get_members()&lt;BR /&gt;all_members = group_members['owner'] + group_members['admins'] + group_members['users']&lt;/P&gt;&lt;P&gt;external_users = []&lt;/P&gt;&lt;P&gt;for username in all_members:&lt;BR /&gt;user = gis.users.get(username)&lt;BR /&gt;if user:&lt;BR /&gt;if user.orgId not in allowed_org_ids:&lt;BR /&gt;external_users.append((username, user.orgId))&lt;/P&gt;&lt;P&gt;for username, org_id in external_users:&lt;BR /&gt;print(f"{username}, {org_id}")&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/user/" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/user/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Jul 2025 17:54:02 GMT</pubDate>
    <dc:creator>ChristopherCounsell</dc:creator>
    <dc:date>2025-07-13T17:54:02Z</dc:date>
    <item>
      <title>Identify users outside partnered collaboration (groups)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1632411#M65540</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;My organization have multiple partnered collaborations and we have groups (that we own) but where there are admins from the partners.&lt;/P&gt;&lt;P&gt;Now I want to change a group from the "any organization" membership setting to the more restricted "Partnered collaboration and my organization's members only", but I can't due to there being a current member that outside partnered collaborations/organizations.&lt;/P&gt;&lt;P&gt;I have tried various methods, including python and rest api to get information on the group members, but I haven't found a way to identify users that could/should be removed...&lt;/P&gt;&lt;P&gt;How can I identify and remove those members?&lt;/P&gt;&lt;P&gt;Any method is fine, but preferably REST API or python arcgis!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 14:26:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1632411#M65540</guid>
      <dc:creator>Nordpil</dc:creator>
      <dc:date>2025-07-11T14:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Identify users outside partnered collaboration (groups)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1632719#M65559</link>
      <description>&lt;P&gt;Get all users in the group then check their orgid against your or your partnered orgs. It should be available as a property.&lt;/P&gt;&lt;P&gt;Here's sample code from AI. I haven't tested it. Would definitely recommend reviewing it before removing users. Sometimes it can be tricky to get users or information when they are not in your org.&lt;/P&gt;&lt;P&gt;from arcgis.gis import GIS&lt;/P&gt;&lt;P&gt;gis = GIS("home")&lt;/P&gt;&lt;P&gt;GROUP_ID = "your_group_id_here"&lt;BR /&gt;PARTNER_ORG_IDS = ["abc1234567890", "def987654321"]&lt;/P&gt;&lt;P&gt;my_org_id = gis.users.me.orgId&lt;BR /&gt;allowed_org_ids = [my_org_id] + PARTNER_ORG_IDS&lt;/P&gt;&lt;P&gt;group = gis.groups.get(GROUP_ID)&lt;BR /&gt;group_members = group.get_members()&lt;BR /&gt;all_members = group_members['owner'] + group_members['admins'] + group_members['users']&lt;/P&gt;&lt;P&gt;external_users = []&lt;/P&gt;&lt;P&gt;for username in all_members:&lt;BR /&gt;user = gis.users.get(username)&lt;BR /&gt;if user:&lt;BR /&gt;if user.orgId not in allowed_org_ids:&lt;BR /&gt;external_users.append((username, user.orgId))&lt;/P&gt;&lt;P&gt;for username, org_id in external_users:&lt;BR /&gt;print(f"{username}, {org_id}")&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/user/" target="_blank"&gt;https://developers.arcgis.com/rest/users-groups-and-items/user/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jul 2025 17:54:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1632719#M65559</guid>
      <dc:creator>ChristopherCounsell</dc:creator>
      <dc:date>2025-07-13T17:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Identify users outside partnered collaboration (groups)</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1633435#M65584</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/412943"&gt;@ChristopherCounsell&lt;/a&gt;&amp;nbsp;I have tried that, but I am unable to get any information in the user object for users that are not in my organization. (I can't even get the full name)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Jul 2025 10:53:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/identify-users-outside-partnered-collaboration/m-p/1633435#M65584</guid>
      <dc:creator>Nordpil</dc:creator>
      <dc:date>2025-07-16T10:53:41Z</dc:date>
    </item>
  </channel>
</rss>

