Join BoxWorks in San Francisco Nov 12-13! Keynotes, product demos, and Box Master Classes. Reserve your spot!

Classification label

Answered
New post

Comments

3 comments

  • mwiller

     The Classification information is contained within special metadata on the file.  You can access it like this:

     

    file = client.file(file_id).get(fields=['metadata.enterprise.securityClassification-6VMVochwUWo'])
    classification = file.metadata['enterprise']['securityClassification-6VMVochwUWo']['Box__Security__Classification__Key']

     

    Also, I'll add an item to our team's backlog to make this a bit easier in the SDK!

    0
    Comment actions Permalink
  • shynee

    Super, Thanks Willer. You are such a life saver.

     

    Another followup question. How do I update the classification on a file ?  Also how do I list all the classifications defined in our BOX environment ?

     

    Thanks Again

     

    Appreciated

     

    Shynee

    0
    Comment actions Permalink
  • Kourtney

    Here are some python SDK code examples for you: 

     

    Add classification: 

    classification_metadata = {
        'Box__Security__Classification__Key': 'Public',
    }
    template_key = 'securityClassification-6VMVochwUWo'
    applied_metadata = client.file(file_id).metadata('enterprise', template_key).create(classification_metadata)

    Update classification: 

    template_key = 'securityClassification-6VMVochwUWo'classification_metadata = client.file(file_id).metadata('enterprise', template_key)
    updates = classification_metadata.start_update()
    updates.update('/Box__Security__Classification__Key', 'Internal')
    classification_metadata.update(updates)

    Get a list of classification values: 

    template_key = 'securityClassification-6VMVochwUWo'
    field_key = 'Box__Security__Classification__Key'
    classification_template = client.metadata_template('enterprise', template_key).get()
    print('Available Classification values:')
    for field in classification_template.fields:
        if field['key'] == field_key:
            for option in field['options']:
                print(option['key'])
    0
    Comment actions Permalink

Please sign in to leave a comment.