Você reconhece isto?<\/P>
<\/P>
Vamos usar a ArcGIS API para Python com groups.search()<\/STRONG> e users.search()<\/STRONG> para obter uma visão geral da nossa organização. Em seguida, compilamos uma matriz - usuários ao longo do eixo y e grupos ao longo do eixo x<\/EM> - com 1 ou 0 para indicar se o usuário é membro do grupo ou não. Esta matriz será escrita em um arquivo CSV.<\/P><\/P>E então o chefe deve ser capaz de importar este CSV em uma planilha colorida e gerenciável. Com ou sem uma pequena ajuda.<\/P><\/P>O script abaixo funciona para você? Apenas 'curta' ou 'compartilhe' se funcionar. E se quiser, você pode simplesmente abrir seu Jupyter Notebook para testá-lo linha por linha.<\/P><\/P><SPAN class="comment token">## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<\/SPAN> <SPAN class="comment token">## Informações de Gerenciamento do ArcGIS Online<\/SPAN> <SPAN class="comment token">## Script: agol_group_membership.py<\/SPAN> <SPAN class="comment token">## Objetivo: criar uma visão geral da associação a grupos na sua organização ArcGIS Online<\/SPAN> <SPAN class="comment token">## Autor: Egge-Jan Polle - Tensing GIS Consultancy<\/SPAN> <SPAN class="comment token">## Data: 3 de agosto de 2018<\/SPAN> <SPAN class="comment token">## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<\/SPAN> <SPAN class="comment token">#<\/SPAN> <SPAN class="comment token"># Este script deve ser executado dentro de um ambiente específico ArcGIS\/Python usando o arquivo batch abaixo<\/SPAN> <SPAN class="comment token"># (Este arquivo batch acompanha a instalação do ArcGIS Pro)<\/SPAN> <SPAN class="comment token"># "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\scripts\\propy.bat" agol_group_membership.py<\/SPAN> <SPAN class="comment token">#<\/SPAN> <SPAN class="keyword token">import<\/SPAN> csv<SPAN class="punctuation token">,<\/SPAN>os<SPAN class="punctuation token">,<\/SPAN> sys <SPAN class="keyword token">from<\/SPAN> arcgis<SPAN class="punctuation token">.<\/SPAN>gis <SPAN class="keyword token">import<\/SPAN> GIS <SPAN class="keyword token">from<\/SPAN> provide_credentials <SPAN class="keyword token">import<\/SPAN> provide_credentials <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'==================='<\/SPAN><SPAN class="punctuation token">)<\/SPAN> <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'O script que está rodando: '<\/SPAN> <SPAN class="operator token">+<\/SPAN> __file__<SPAN class="punctuation token">)<\/SPAN> <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'Primeiro você precisa fazer login no ArcGIS Online'<\/SPAN><SPAN class="punctuation token">)<\/SPAN> <SPAN class="comment token"># Fazer login<\/SPAN> username<SPAN class="punctuation token">,<\/span> password <span class="operator token">=<span> provide_credentials<span>(</span>) my_agol <span class="operator token">=<span> GIS<span>(</span>"https://www.arcgis.com"</span>, username<span>,</span> password<span>) <span class="keyword token">print</span>("Início: " + datetime.datetime.today().strftime('%c')) <span class="comment token">## Obter todos os grupos</span> my_groups = my_agol.groups.search() <span class="comment token">## Opcionalmente: dar uma olhada em todos os grupos</span> <span class="comment token">#my_groups</span> <span class="comment token">## Opcionalmente: contar o número de grupos</span> <span class="comment token">#len(my_groups)</span> <span class="comment token">## Obter todos os usuários</span> my_users = my_agol.users.search(max_users = 350) # O padrão max_users = 100, então aumente se tiver mais <span class="comment token">## Opcionalmente: dar uma olhada em todos os usuários</span> <span class="comment token">#my_users</span> <span class="comment token">## Opcionalmente: contar o número de usuários</span> <span class="comment token">#len(my_users)</span> <span class="comment token">## Criar uma lista com todos os títulos dos grupos</span> my_group_titles = [] for my_group in my_groups: my_group_titles.append(my_group.title) <span class="comment token">## Criar uma lista com nomes dos campos</span> fieldnames = [] fieldnames = ['USERNAME','EMAIL'] for title in my_group_titles: fieldnames.append(title) <span class="comment token">## Opcionalmente: dar uma olhada nos nomes dos campos</span> <span class="comment token">#fieldnames</span> <span class="comment token">## Criar um arquivo CSV com uma matriz dos grupos com seus membros</span> today = datetime.datetime.today().strftime('%Y%m%d') fname = 'AGOL_Group_Membership'+today+'.csv' try: os.remove(fname) except OSError: pass outfile = open(fname, 'a') writer = csv.DictWriter(outfile, delimiter=';', lineterminator='\n', fieldnames=fieldnames) writer.writeheader() <span class="comment token">## Adicionar para cada usuário o nome completo e email e para cada grupo um 1 ou 0, dependendo da associação ao grupo</span> for user in my_users: membership = [] try: thisUser = {} thisUser['USERNAME'] = user.fullName thisUser<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'EMAIL'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> user<SPAN class="punctuation token">.</SPAN>email <SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># A filiação a grupos fora da organização gerará um erro ("Você não tem permissões para acessar este recurso ou realizar esta operação.")</SPAN> <SPAN class="keyword token">for</SPAN> group <SPAN class="keyword token">in</SPAN> user<SPAN class="punctuation token">.</SPAN>groups<SPAN class="punctuation token">:</SPAN> membership<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>group<SPAN class="punctuation token">.</SPAN>title<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">pass</SPAN> <SPAN class="keyword token">for</SPAN> title <SPAN class="keyword token">in</SPAN> my_group_titles<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> title <SPAN class="keyword token">in</SPAN> membership<SPAN class="punctuation token">:</SPAN> thisUser<SPAN class="punctuation token">[</SPAN>title<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> thisUser<SPAN class="punctuation token">[</SPAN>title<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</span> <span class="keyword token">except</span><span class="punctuation token">:</span> <span class="keyword token">print</span><span class="punctuation token">(</span><span class="string token">"POR FAVOR, NOTE: nenhuma informação pode ser recuperada sobre o usuário "</span><span class="operator token">+</span>user<span class="punctuation token">.</span>fullName<span class="operator token">+</span><span class="string token">"."</span><span class="punctuation token">)</span> <span class="keyword token">pass</span> writer<span class="punctuation token">.</span>writerow<span class="punctuation token">(</span>thisUser<span class="punctuation token">)</span> outfile<span class="punctuation token">.</span>close<span class="punctuation token">()</span> <span class="keyword token">print</span> <span class="punctuation token">(</span><span class="string token">"Pronto: "</span><span class="operator token">+</span>datetime<span class="punctuation token">.</span>datetime<span class="punctuation token">.</span>today<span class="punctuation token">()</span><span class="punctuation token">.</span>strftime<span class="punctuation token">('%c')</span><span class="punctuation token">)</span> <span class="keyword token">print</span><span class="punctuation token">()</span> <span class="keyword token">print</span><span class="punctuation token">()</span><span class="string token"'==================='></span> <span class="keyword token"'print'></span><span>'O arquivo CSV pode ser encontrado aqui:'></span> <span>'print'</span>(os.path.abspath(fname)) <span>'print'</span>(<string>'==================='></string>) <p></p><p>E aqui está o script <strong style='font-family: courier new, courier, monospace;'>provide_credentials</strong>, que é usado acima para fazer login no AGOL:</p><p></p><pre><code><span style='color:#0000FF'>import </span> json, os <span style='color:#0000FF'>from </span> getpass <span style='color:#0000FF'>import </span> getpass <em># para aceitar senhas de forma interativa</em> <span style='color:#0000FF'>def </span><strong style='color:#795E26'>provide_credentials</strong>(<em>):</em> file_with_credentials = 'my_credentials.json' username = '' password = '' <strong style='color:#0000FF'>if </strong> os.path.exists(file_with_credentials): <strong style='color:#0000FF'>with </strong> open(file_with_credentials) <strong style='color:#0000FF'>as </strong> f: data = json.load(f) username = data['username'] password = data['password'] <strong style='color:#0000FF'>if </strong> not username or username == 'USERNAME' or not password or password == 'PASSWORD': username = input('Por favor, insira seu nome de usuário: ') password = getpass('Por favor, insira sua senha (isso permanecerá invisível): ') <strong style='color:#0000FF'>return </strong> username, password <p></p><p>Com o arquivo de entrada <strong style='font-family: courier new, courier, monospace;'>my_credentials.json</strong>:</p><p></p><pre><code>{ "username": "USERNAME", "password": "PASSWORD" }
<SPAN class="comment token">## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<\/SPAN> <SPAN class="comment token">## Informações de Gerenciamento do ArcGIS Online<\/SPAN> <SPAN class="comment token">## Script: agol_group_membership.py<\/SPAN> <SPAN class="comment token">## Objetivo: criar uma visão geral da associação a grupos na sua organização ArcGIS Online<\/SPAN> <SPAN class="comment token">## Autor: Egge-Jan Polle - Tensing GIS Consultancy<\/SPAN> <SPAN class="comment token">## Data: 3 de agosto de 2018<\/SPAN> <SPAN class="comment token">## ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<\/SPAN> <SPAN class="comment token">#<\/SPAN> <SPAN class="comment token"># Este script deve ser executado dentro de um ambiente específico ArcGIS\/Python usando o arquivo batch abaixo<\/SPAN> <SPAN class="comment token"># (Este arquivo batch acompanha a instalação do ArcGIS Pro)<\/SPAN> <SPAN class="comment token"># "C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\scripts\\propy.bat" agol_group_membership.py<\/SPAN> <SPAN class="comment token">#<\/SPAN> <SPAN class="keyword token">import<\/SPAN> csv<SPAN class="punctuation token">,<\/SPAN>os<SPAN class="punctuation token">,<\/SPAN> sys <SPAN class="keyword token">from<\/SPAN> arcgis<SPAN class="punctuation token">.<\/SPAN>gis <SPAN class="keyword token">import<\/SPAN> GIS <SPAN class="keyword token">from<\/SPAN> provide_credentials <SPAN class="keyword token">import<\/SPAN> provide_credentials <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'==================='<\/SPAN><SPAN class="punctuation token">)<\/SPAN> <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'O script que está rodando: '<\/SPAN> <SPAN class="operator token">+<\/SPAN> __file__<SPAN class="punctuation token">)<\/SPAN> <SPAN class="keyword token">print<\/SPAN><SPAN class="punctuation token">(<\/SPAN><SPAN class="string token">'Primeiro você precisa fazer login no ArcGIS Online'<\/SPAN><SPAN class="punctuation token">)<\/SPAN> <SPAN class="comment token"># Fazer login<\/SPAN> username<SPAN class="punctuation token">,<\/span> password <span class="operator token">=<span> provide_credentials<span>(</span>) my_agol <span class="operator token">=<span> GIS<span>(</span>"https://www.arcgis.com"</span>, username<span>,</span> password<span>) <span class="keyword token">print</span>("Início: " + datetime.datetime.today().strftime('%c')) <span class="comment token">## Obter todos os grupos</span> my_groups = my_agol.groups.search() <span class="comment token">## Opcionalmente: dar uma olhada em todos os grupos</span> <span class="comment token">#my_groups</span> <span class="comment token">## Opcionalmente: contar o número de grupos</span> <span class="comment token">#len(my_groups)</span> <span class="comment token">## Obter todos os usuários</span> my_users = my_agol.users.search(max_users = 350) # O padrão max_users = 100, então aumente se tiver mais <span class="comment token">## Opcionalmente: dar uma olhada em todos os usuários</span> <span class="comment token">#my_users</span> <span class="comment token">## Opcionalmente: contar o número de usuários</span> <span class="comment token">#len(my_users)</span> <span class="comment token">## Criar uma lista com todos os títulos dos grupos</span> my_group_titles = [] for my_group in my_groups: my_group_titles.append(my_group.title) <span class="comment token">## Criar uma lista com nomes dos campos</span> fieldnames = [] fieldnames = ['USERNAME','EMAIL'] for title in my_group_titles: fieldnames.append(title) <span class="comment token">## Opcionalmente: dar uma olhada nos nomes dos campos</span> <span class="comment token">#fieldnames</span> <span class="comment token">## Criar um arquivo CSV com uma matriz dos grupos com seus membros</span> today = datetime.datetime.today().strftime('%Y%m%d') fname = 'AGOL_Group_Membership'+today+'.csv' try: os.remove(fname) except OSError: pass outfile = open(fname, 'a') writer = csv.DictWriter(outfile, delimiter=';', lineterminator='\n', fieldnames=fieldnames) writer.writeheader() <span class="comment token">## Adicionar para cada usuário o nome completo e email e para cada grupo um 1 ou 0, dependendo da associação ao grupo</span> for user in my_users: membership = [] try: thisUser = {} thisUser['USERNAME'] = user.fullName thisUser<SPAN class="punctuation token">[</SPAN><SPAN class="string token">'EMAIL'</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> user<SPAN class="punctuation token">.</SPAN>email <SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="comment token"># A filiação a grupos fora da organização gerará um erro ("Você não tem permissões para acessar este recurso ou realizar esta operação.")</SPAN> <SPAN class="keyword token">for</SPAN> group <SPAN class="keyword token">in</SPAN> user<SPAN class="punctuation token">.</SPAN>groups<SPAN class="punctuation token">:</SPAN> membership<SPAN class="punctuation token">.</SPAN>append<SPAN class="punctuation token">(</SPAN>group<SPAN class="punctuation token">.</SPAN>title<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">except</SPAN><SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">pass</SPAN> <SPAN class="keyword token">for</SPAN> title <SPAN class="keyword token">in</SPAN> my_group_titles<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">if</SPAN> title <SPAN class="keyword token">in</SPAN> membership<SPAN class="punctuation token">:</SPAN> thisUser<SPAN class="punctuation token">[</SPAN>title<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN> <SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> thisUser<SPAN class="punctuation token">[</SPAN>title<SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</span> <span class="keyword token">except</span><span class="punctuation token">:</span> <span class="keyword token">print</span><span class="punctuation token">(</span><span class="string token">"POR FAVOR, NOTE: nenhuma informação pode ser recuperada sobre o usuário "</span><span class="operator token">+</span>user<span class="punctuation token">.</span>fullName<span class="operator token">+</span><span class="string token">"."</span><span class="punctuation token">)</span> <span class="keyword token">pass</span> writer<span class="punctuation token">.</span>writerow<span class="punctuation token">(</span>thisUser<span class="punctuation token">)</span> outfile<span class="punctuation token">.</span>close<span class="punctuation token">()</span> <span class="keyword token">print</span> <span class="punctuation token">(</span><span class="string token">"Pronto: "</span><span class="operator token">+</span>datetime<span class="punctuation token">.</span>datetime<span class="punctuation token">.</span>today<span class="punctuation token">()</span><span class="punctuation token">.</span>strftime<span class="punctuation token">('%c')</span><span class="punctuation token">)</span> <span class="keyword token">print</span><span class="punctuation token">()</span> <span class="keyword token">print</span><span class="punctuation token">()</span><span class="string token"'==================='></span> <span class="keyword token"'print'></span><span>'O arquivo CSV pode ser encontrado aqui:'></span> <span>'print'</span>(os.path.abspath(fname)) <span>'print'</span>(<string>'==================='></string>) <p></p><p>E aqui está o script <strong style='font-family: courier new, courier, monospace;'>provide_credentials</strong>, que é usado acima para fazer login no AGOL:</p><p></p><pre><code><span style='color:#0000FF'>import </span> json, os <span style='color:#0000FF'>from </span> getpass <span style='color:#0000FF'>import </span> getpass <em># para aceitar senhas de forma interativa</em> <span style='color:#0000FF'>def </span><strong style='color:#795E26'>provide_credentials</strong>(<em>):</em> file_with_credentials = 'my_credentials.json' username = '' password = '' <strong style='color:#0000FF'>if </strong> os.path.exists(file_with_credentials): <strong style='color:#0000FF'>with </strong> open(file_with_credentials) <strong style='color:#0000FF'>as </strong> f: data = json.load(f) username = data['username'] password = data['password'] <strong style='color:#0000FF'>if </strong> not username or username == 'USERNAME' or not password or password == 'PASSWORD': username = input('Por favor, insira seu nome de usuário: ') password = getpass('Por favor, insira sua senha (isso permanecerá invisível): ') <strong style='color:#0000FF'>return </strong> username, password <p></p><p>Com o arquivo de entrada <strong style='font-family: courier new, courier, monospace;'>my_credentials.json</strong>:</p><p></p><pre><code>{ "username": "USERNAME", "password": "PASSWORD" }
Bons códigos!
Egge-Jan
Forgive my ignorance but where in the world would
<SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">print</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN>os<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">.</SPAN>path<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">.</SPAN>abspath<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN>fname<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN>
be if I ran this on and Enterprise Notebook?
I ran this with no errors and it said:
=================== The CSV file can be found here: /arcgis/AGOL_Group_Membership20200416.csv =================== But I cannot find this file
Hi Jeff Timm,
Has the file not just been created in the same folder where the Python script resides?
BR,
Egge-Jan Pollé, this seems extremely useful, and I really appreciate you sharing! This is the type of more advanced GIS work (utilizing the API's) that I want to get in to, but for someone who is a complete newbie, I'm a bit unclear where to start. I've written/modified scripts to use in geoprocessing, but never involving multiple python files or interacting with my Organization account. Do you think you could go into a bit more detail how to approach this? (also, does this script work with both AGOL and Enterprise accounts?)
I created the JSON file and two separate .PY scripts from the code you provided, all in the same folder. Then I added the "agol_group_membership.py" script to a toolbox in ArcGIS Pro and attempted to run the tool. This is the error message I got:
Obviously I'm just not understanding how to set it up correctly. I know it's a lot to ask, but if you could at least maybe share a resource that helps explain how to get started with this stuff that would be SO helpful!
Wishing you all the best,
Katherine
Hi Katherine Clark,
Please have a look at the screen capture of the DOSBox below.
Please note: It is very important to run this script in combination with the bat file mentioned to make sure you run it in the correct ArcGIS/Python environment (This batch file comes with the installation of ArcGIS Pro). Without making sure you use this correct environment the script will fail anyway...
Please let me know if this works for you.
Stay safe, stay home - have a nice weekend.
Thank you! I got it to run once I changed the credentials in the JSON to be my ArcGIS Online login rather than my Enterprise login (is there a way to make this work with Enterprise?)
Strangely, I did receive these messages about not having permissions:
However, there was a csv produced in the same folder where the scripts are stored, as expected. The only bad part....the csv has different rows for each user, but no column separations. Have you experienced this before?
Update: I was able to correct the csv file by using the "Text to Columns" tool in the Data tab of the Excel Ribbon since all the values were neatly separated by semi colons.
However, still curious if this is expected behavior for the output of the script.
Dumb question. I wanted to find documentation about this:
"gis.users.search(max_count=...)"
Where would I find it? The answer will be embarrassing, but I can't find it. I've searched the ArcGIS API for python documentation and I don't see an explanation of this property.
I was getting a list of users and did not realize there was a limit of 100 returned and was getting extremely frustrated with the results, wondering why they were incomplete. I found your post and discovered the "max_count" property, and am now wondering how I could go straight to the source and find such information more directly.
Thank you,
Randy McGregor
Easiest way to get it to get it to automatically open in Excel as a table is to change the delimiter to a comma from a semi colon. Since we can use whatever delimeters we wish the decision on what to include here is based on the needs of the client application that will be consuming the output.
Not sure if anyone answered your question regarding making it work with Enterprise.
The answer is yes it will work with any 'portal' of whether that portal is enterprise on premesis, cloud, or arcgisonline.
Just enter the details of the portal under the login comment at the top.
<SPAN class="" style="color: slategray; border: 0px; font-weight: inherit;"># Log in</SPAN> username<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN> password <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;">=</SPAN> provide_credentials<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN> my_agol <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;">=</SPAN> GIS<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN><SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"><SPAN style="border: 0px; font-weight: inherit;"><SPAN>"</SPAN><A _jive_internal="true" href="https://community.esri.com/yourEnterprise.com/PortalWebadaptor" target="_blank">https://yourEnterprise.com/PortalWebadaptor</A></SPAN><SPAN style="border: 0px; font-weight: inherit;">"</SPAN></SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN> username<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN> password<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN>
If the variable name "my_agol" seems a bit like a mental roadblock, you can rename it throughout the script to something like "my_portal".
Egge-Jan shared a highly adaptable and fantastically useful nugget of code here that makes short work of pulling info into spreadsheets about users and groups.
If like me you want the code to work on all your portals without much modification there are a few things you can do such as automatically naming your output csv by pulling the portal name directly via implementation of "my_portal.properties.portalName" in the fname= variable.
Could anyone suggest how this could be modified to list users within the Groups, where those users are not from the same organisation? I can get it to list our organisation's users and their Group memberships, but it excludes the hundreds of users we have in those Groups within our hub community organisation.Many thanks.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.