0

How do I use the UserInvitationManager class with the ArcGIS Python API?

The documentation is scant and there are no examples.

I have a workflow that will involve inviting a separate account of mine to ~500 groups, so that it can manage adding users from that other community. This is accomplished through a script, which has not been an issue. I would also like to use a script to accept those 500 invitations so I don't have to click 'accept' that many times. This seems theoretically possible based on the documentation, which I believe is using the python api to make a JSOSN post in the background.

When I attempt to access the UserInvitationManager class I get an error from one of the helper scripts that I am not sure how to start resolving.

from arcgis.gis import sharing as share
userAccount = gis.properties.user
invitations = share.UserInvitationManager(userAccount)

And I get a resultant property map error.

Error from above script

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Dec 7, 2023 at 18:10

1 Answer 1

0

I realized I was using the wrong user object and missed in the documentation the need to call the list property. To accept all of the invitations for a user...

from arcgis.gis import sharing as GIShare
user = gis.users.get('UserName')
invitationManager = GIShare.UserInvitationManager(user=user)
inviteList = invitationManager.list
for invite in invitationsList:
 invite.accept()
answered Dec 7, 2023 at 18:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.