<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Setting Metadata on files - Python API in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364625#M20707</link>
    <description>&lt;P&gt;Thanks for pointing a few things out that I seem to have overlooked. The freezing up, ended up being due to wrong formatting and an incorrect unique id for the custom string template - now sourced correctly using the following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;template = dropbox.file_properties.PropertyFieldTemplate(name="MyTemplate", description="description",type=dropbox.file_properties.PropertyType.string)
my_template_id = dbx.file_properties_templates_add_for_user("MyTemplate","description",[template]).template_id


data =  dropbox.file_properties.PropertyField(name='MyTemplate', value='foobar')&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;Regarding the PropertyFieldTemplate the available types seems to be either 'string' or 'other'. Just curious, how you would use the PropertyType 'other' to store data?&lt;/LI&gt;&lt;LI&gt;Can property group data be altered on uploaded files or does it have to be added as part an upload process?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Wed, 11 Sep 2019 22:21:28 GMT</pubDate>
    <dc:creator>MorgsCode</dc:creator>
    <dc:date>2019-09-11T22:21:28Z</dc:date>
    <item>
      <title>Setting Metadata on files - Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/363894#M20670</link>
      <description>&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've just started using the Dropbox Python API, but am a bit confused on how to add custom metadata to new or exists files.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to defined my own PropertyGroup with the data stored in a PropertyField (as shown in the code below). However, passing this as a parameter of dbx.files_upload() causes the process to freezes up.&amp;nbsp; Should the template_id of the property group be defined differently?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data =  dropbox.file_properties.PropertyField('foo', 'bar')

my_property_group = dropbox.file_properties.PropertyGroup()

my_property_group .template_id = '/|test_template'
my_property_group .fields = [data]

with open(r'C:\test_file.txt', "rb") as f:
    dbx.files_upload(f.read(), '/test_file.txt', mute = True, property_groups=[my_property_group ])&lt;/PRE&gt;&lt;P&gt;Any help on this would be much appreciated!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Sep 2019 16:40:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/363894#M20670</guid>
      <dc:creator>MorgsCode</dc:creator>
      <dc:date>2019-09-07T16:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Metadata on files - Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364150#M20675</link>
      <description>&lt;P&gt;Thanks for the report. I'll be happy to help with this, but I could use a few points of clarification:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;What do you mean exactly when you say "the process to freezes up"? How are you checking this and what exactly do you see? Also, depending on the size of the file and your network connection, it may take some time to upload, so make sure you give it enough time to complete.&lt;/LI&gt;
&lt;LI&gt;Is&amp;nbsp;'/|test_template' the actual value you're sending, or is that just something you put there for this post in order to not post the actual ID? Actual template ID values should start with "ptid:", e.g., as returned by&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/file_properties.html#dropbox.file_properties.AddTemplateResult" target="_self"&gt;file_properties_templates_add_for_user&lt;/A&gt; or&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.file_properties_templates_list_for_user" target="_self"&gt;&lt;SPAN&gt;file_properties_templates_list_for_user&lt;/SPAN&gt;&lt;/A&gt;.&amp;nbsp;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I also notice that you're not using the return value of 'dbx.files_upload'. You may want to print or save that value somewhere for reference. If the call succeeds, it will contain the metadata of the uploaded file.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 15:14:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364150#M20675</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-09T15:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Metadata on files - Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364625#M20707</link>
      <description>&lt;P&gt;Thanks for pointing a few things out that I seem to have overlooked. The freezing up, ended up being due to wrong formatting and an incorrect unique id for the custom string template - now sourced correctly using the following code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;template = dropbox.file_properties.PropertyFieldTemplate(name="MyTemplate", description="description",type=dropbox.file_properties.PropertyType.string)
my_template_id = dbx.file_properties_templates_add_for_user("MyTemplate","description",[template]).template_id


data =  dropbox.file_properties.PropertyField(name='MyTemplate', value='foobar')&lt;/PRE&gt;&lt;UL&gt;&lt;LI&gt;Regarding the PropertyFieldTemplate the available types seems to be either 'string' or 'other'. Just curious, how you would use the PropertyType 'other' to store data?&lt;/LI&gt;&lt;LI&gt;Can property group data be altered on uploaded files or does it have to be added as part an upload process?&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 11 Sep 2019 22:21:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364625#M20707</guid>
      <dc:creator>MorgsCode</dc:creator>
      <dc:date>2019-09-11T22:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Setting Metadata on files - Python API</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364753#M20712</link>
      <description>&lt;P&gt;Thanks for following up. I'm glad to hear you already sorted most of this out.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The&amp;nbsp;PropertyType.other option is just a catch-all for forwards compatibility with any potential new&amp;nbsp;PropertyType fields. It's not actually something you can use as an alternative to&amp;nbsp;PropertyType.string. Currently the&amp;nbsp;Dropbox API only supports the string type. What other data type in particular would you be looking to use? I'll be happy to pass it along as a feature request.&lt;/LI&gt;
&lt;LI&gt;You can change the property values on an existing file without re-uploading it. To do so, you would use the&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.file_properties_properties_update" target="_self"&gt;file_properties_properties_update&lt;/A&gt; method&amp;nbsp;and/or the&amp;nbsp;&lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox.Dropbox.file_properties_properties_overwrite" target="_self"&gt;file_properties_properties_overwrite&lt;/A&gt; method. (Be sure to read the documentation for information on the difference between the two.)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 12 Sep 2019 15:26:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Setting-Metadata-on-files-Python-API/m-p/364753#M20712</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-12T15:26:15Z</dc:date>
    </item>
  </channel>
</rss>

