You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
cgeeklucky
7 years agoExplorer | Level 4
File properties
Can anyone tell me why exactly I need to create a team to add file attributes to a file? All I want to do is add a single attribute called "FileParentIdentifier" (which will hold a string value i.e ...
- 7 years agoA "team" refers to a Dropbox Business level collection of accounts. If you're interested, you can find more information here:
https://www.dropbox.com/business
Note that you don't need a Dropbox Business team to use the file properties functionality on the Dropbox API though:
https://www.dropbox.com/developers/documentation/http/documentation#file_properties
You can use a "full Dropbox" app to create templates that you can apply to files, whether or not the linked account is part of a Business team. (There is also a concept of templates owned by teams, but that is not required.)
So, in short, you can:
1. Register a full Dropbox app, if you haven't already: https://www.dropbox.com/developers/apps/create
2. Connect a user using the OAuth flow: https://www.dropbox.com/developers/reference/oauth-guide
3. Create a template using/2/file_properties/templates/add_for_user : https://www.dropbox.com/developers/documentation/http/documentation#file_properties-templates-add_for_user
4. Add file properties for your template to any number of files using /2/file_properties/properties/add: https://www.dropbox.com/developers/documentation/http/documentation#file_properties-properties-add
Greg-DB
Dropbox Staff
A "team" refers to a Dropbox Business level collection of accounts. If you're interested, you can find more information here:
https://www.dropbox.com/business
Note that you don't need a Dropbox Business team to use the file properties functionality on the Dropbox API though:
https://www.dropbox.com/developers/documentation/http/documentation#file_properties
You can use a "full Dropbox" app to create templates that you can apply to files, whether or not the linked account is part of a Business team. (There is also a concept of templates owned by teams, but that is not required.)
So, in short, you can:
1. Register a full Dropbox app, if you haven't already: https://www.dropbox.com/developers/apps/create
2. Connect a user using the OAuth flow: https://www.dropbox.com/developers/reference/oauth-guide
3. Create a template using/2/file_properties/templates/add_for_user : https://www.dropbox.com/developers/documentation/http/documentation#file_properties-templates-add_for_user
4. Add file properties for your template to any number of files using /2/file_properties/properties/add: https://www.dropbox.com/developers/documentation/http/documentation#file_properties-properties-add
https://www.dropbox.com/business
Note that you don't need a Dropbox Business team to use the file properties functionality on the Dropbox API though:
https://www.dropbox.com/developers/documentation/http/documentation#file_properties
You can use a "full Dropbox" app to create templates that you can apply to files, whether or not the linked account is part of a Business team. (There is also a concept of templates owned by teams, but that is not required.)
So, in short, you can:
1. Register a full Dropbox app, if you haven't already: https://www.dropbox.com/developers/apps/create
2. Connect a user using the OAuth flow: https://www.dropbox.com/developers/reference/oauth-guide
3. Create a template using/2/file_properties/templates/add_for_user : https://www.dropbox.com/developers/documentation/http/documentation#file_properties-templates-add_for_user
4. Add file properties for your template to any number of files using /2/file_properties/properties/add: https://www.dropbox.com/developers/documentation/http/documentation#file_properties-properties-add
cgeeklucky
7 years agoExplorer | Level 4
Thank you for your reply .
I have already tried above method .
I am using full dropbox app and using dropbox sdk.
I tried to upload a file with property groups , (I created template, then created property field using property field init method , added to property group array. For the property group template_id, I used same template id obtained in response when creating template).
But some how , it is failing . I could successfully upload a file, but metadata of uploaded file do not contain property group parameter.
I was able to figure out the error. It is "template do not fit ".
I have already googled lot for this error , but do not know what is going wrong .
I have one more confusion, do we need to create a separate template for each file . If not, how do I obtain single template ID I already created for all files.
I have already tried above method .
I am using full dropbox app and using dropbox sdk.
I tried to upload a file with property groups , (I created template, then created property field using property field init method , added to property group array. For the property group template_id, I used same template id obtained in response when creating template).
But some how , it is failing . I could successfully upload a file, but metadata of uploaded file do not contain property group parameter.
I was able to figure out the error. It is "template do not fit ".
I have already googled lot for this error , but do not know what is going wrong .
I have one more confusion, do we need to create a separate template for each file . If not, how do I obtain single template ID I already created for all files.
- Greg-DB7 years agoDropbox Staff
It sounds like you're referring to the 'does_not_fit_template' error, which is documented as:
"One or more of the supplied property fields does not conform to the template specifications."
That means that the property fields that you're attempting to set for that file do not match the template you are using. You'll need to change your code to match the template you're using.
You do not need to create a new template for each file. You can use a single template on any number of files. You can use /2/file_properties/templates/list_for_user to list existing templates.
By the way, those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible. Those have corresponding native methods for the HTTPS endpoints. You did mention you're using an SDK, but you didn't mention which one.
- cgeeklucky7 years agoExplorer | Level 4
Dropbox SDK I am using is "SwiftyDropbox"
Below is code snippet.
//create template let template = FileProperties.PropertyFieldTemplate(name: "FileTemplate", description_: "File's Custom Properties Here", type: .string_) //add template client?.file_properties.templatesAddForUser(name: "User", description_: "Template for User", fields: [template]).response(completionHandler: { (templateResult, error) in if let templateID = templateResult?.templateId { //upload file using property groups //create custom file attribute using property field let field = FileProperties.PropertyField(name: "ParentFolderID", value: "123456") //create property group, add template id and fields let propertyGroup = FileProperties.PropertyGroup(templateId: templateID, fields: [field]) //upload file with above property group let url = AppDirectory.albums.locationUrl.appendingPathComponent("15331256694236.png") client?.files.upload(path: "/AppFolder/\(Date().toString).png", mode: .add, autorename: false, clientModified: Date(), mute: true, propertyGroups: [propertyGroup], input: url).response(completionHandler: { (metadata, error) in print(metadata) }) } })
I am getting 'does_not_fit_template' error.
I have followed the same steps. Rather than adding property groups separately using properties/add, I am adding groups while uploading a file. Am I missing anything?
- Greg-DB7 years agoDropbox Staff
It looks like the issue is that you're using a different field name when creating the template and then when trying to apply it later. I.e.:
let template = FileProperties.PropertyFieldTemplate(name: "FileTemplate", description_: "File's Custom Properties Here", type: .string_)
But then:
let field = FileProperties.PropertyField(name: "ParentFolderID", value: "123456")
That name "ParentFolderID" should be "FileTemplate" (or whatever you want it to be, as long as you're consistent).
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,911 PostsLatest Activity: 8 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!