Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Extend collaborations using Python SDK

Answered
New post

Comments

5 comments

  • cbetta

    Hi  , let's see if I can help with this.

     

    I'm not too sure why . you are fetching collaborations when you want to add a new one. A collaboration is essentially a mapping between 1 item (folder, file, etc) and 1 user or group.

     

    In this case, if you want to add a new collaboration for an external user, you simply want to use the `POST /collaborations/` endpoint.  https://box.dev/en/reference/post-collaborations/

     

    I this case, you will want to invite the user by email as follows:

     

    from boxsdk.object.collaboration import CollaborationRole
    
    email_of_invitee = 'testuser@example.com'
    collaboration = client.folder(folder_id='22222').collaborate_with_login(email_of_invitee, CollaborationRole.VIEWER)

     

    0
    Comment actions Permalink
  • KoenThijssen

    Hi , I'm not sure this is what I want to do.

    As a clarification; the correct users are already collaborated on the correct folders. However, the access to folders of certain users expires after 60 days, so (I think) the collaboration expires after this time. It seems like I want to extend these collaborations instead of adding them as new users.

    0
    Comment actions Permalink
  • cbetta

    Ah yes, that is a different use case. In that case, I'd first recommend looking into your enterprise settings and confirm if this feature has been configured to allow extending. If it has, I think you can updated the `expires_at` field of the collaboration using this endpoint:

     

    https://box.dev/en/reference/put-collaborations-id/

     

    If it is not set, you will need to delete and then reinvite the user.

    0
    Comment actions Permalink
  • KoenThijssen

    Thanks again for your reply. Extending is collaborations is allowed according to the enterprise settings.

    Unfortunately, updating the 'expires_at' field did not work using update_collaboration. Indeed, another option (the final option imo) would be removing and adding collaborations to refresh the expiration date. However, this would not be preferable in our enterprise.

     

    If this feature would be added in the future I would love to know!

     

    Thanks again for the suggestions! I'll mark this post as solved for now.

    0
    Comment actions Permalink
  • tselani

    I am having the same problem, I can use the Try this API to update the expiration to a distant date, but full removal of the expiration would be a helpful feature. 

     

    https://pulse.box.com/forums/909778-help-shape-the-future-of-box/suggestions/40864717-ability-to-remove-collaborator-expiration-via-web

    0
    Comment actions Permalink

Post is closed for comments.