I have a workflow that involves managing content and users between our organizational account and our Hub account. This process involves hundreds of groups that will require a half-dozen users each. An important piece of the puzzle is a script that invites my Hub account into all of the several hundred groups (as a manager) so that, from that Hub account, another script can run that creates the users and adds them to their respective groups.
Finding my relevant groups and inviting my Hub account is no problem. However, I would like to be able to accept all of those invitations within the script, so I don't have to click 'accept' five hundred times.
According to the documentation, the gis.sharing module, and calling the UserInvitationManager, should do the trick. However, I keep getting property map errors when I attempt to access invitations.
from arcgis.gis import sharing as GIShare
user = gis.properties.user
GIShare.UserInvitationManager(user=user)
Looking for some guidance on how to use this....apologies if I'm overlooking something obvious as I'm a bit of a novice. There's not a lot of documentation.
Solved! Go to Solution.
Figured this out. I was using the wrong type of user object and missed in the documentation the need to access the list property for the invitation manager. To find and accept all of your 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()
Figured this out. I was using the wrong type of user object and missed in the documentation the need to access the list property for the invitation manager. To find and accept all of your 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()