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

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()

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.