Assign a legal hold to a file, file version, folder, or user.
The item to assign the policy to
6564564
The ID of item to assign the policy to
folder
The type of item to assign the policy to
Value is one of file
,file_version
,folder
,user
123244
The ID of the policy to assign.
Returns a new legal hold policy assignment.
An unexpected client error.
curl -X POST https://api.box.com/2.0/legal_hold_policy_assignments \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H 'Content-Type: application/json" '
-d '{
"policy_id": "123244",
"assign_to": {
"type": "folder",
"id": "6564564"
}
}'
var requestParams = new BoxLegalHoldPolicyAssignmentRequest()
{
PolicyId = "11111",
AssignTo = new BoxRequestEntity()
{
Type = "folder",
Id = "12345"
}
};
BoxLegalHoldPolicyAssignment assignment = await client.LegalHoldPoliciesManager
.CreateAssignmentAsync(requestParams);
BoxLegalHoldPolicy policy = new BoxLegalHoldPolicy(api, policyID);
BoxFolder folder = new BoxFolder(api, folderID);
policy.assignTo(folder);
folder_to_assign = client.folder(folder_id='22222')
assignment = client.legal_hold_policy(policy_id'12345').assign(folder_to_assign)
print('Applied policy "{0}" to {1} {2}'.format(
assignment.legal_hold_policy.policy_name,
assignment.assigned_to.type,
assignment.assigned_to.id,
))
client.legalHoldPolicies.assign('11111', 'folder', '12345')
.then(assignment => {
/* assignment -> {
type: 'legal_hold_policy_assignment',
id: '22222',
legal_hold_policy:
{ type: 'legal_hold_policy',
id: '11111',
policy_name: 'IRS Audit' },
assigned_to: { type: 'folder', id: '12345' },
assigned_by:
{ type: 'user',
id: '33333',
name: 'Example User',
login: 'user@example.com' },
assigned_at: '2016-05-18T17:38:03-07:00',
deleted_at: null }
*/
});
client.legalHolds.forceApply(policyId: "1234", assignToId: "4568" ,assignToType: "file") { (result: Result<LegalHoldPolicyAssignment, BoxSDKError>) in
guard case let .success(assignment) = result else {
print("Error assigning legal hold policy")
return
}
print("Assigned a legal hold policy at \"\(assignment.assignedAt)\"")
}