Change Default Column Values

The Default Column Values setting is a great option for setting values for new items in a library. This setting allows us, for example, to set different values for different folders, which can be beneficial when all items within certain folders should have the same value by default (e.g., for search or filtering purposes).

This setting is available on the document library settings page.

https://TENANT.sharepoint.com/sites/SITE/_layouts/15/ColumnDefaults.aspx?List={LISTID}

As shown in the image, we can set default values for each column at each folder and subfolder level. Default Column Values Settings

Please note that not all columns are available for this setting. For example, Lookup and Person columns are not supported.

Of course, it is ok to set all values using the UI but what if we want to automate this process?


The main issue in this case is that this setting is not saved in the column settings or the list settings. At first glance, it seems there is no SharePoint API to handle it.

During research, I found that this setting is saved in a file! named client_LocationBasedDefaults.html, located in the Forms folder of the library.

Screen from SP Editor Extension: File editor of SP Editor Extension

The content of the file is a XML. An example of structure is shown below:

<MetadataDefaults><a href="/sites/example/LIBRARY/folder1/subFolder1"><DefaultValue FieldName="TextColumn">SubTest</DefaultValue></a><a href="/sites/example/LIBRARY/folder2/subFolder2"><DefaultValue FieldName="TextColumn">SubTest2</DefaultValue><DefaultValue FieldName="DateColumn">2025-05-01T07:00:00Z</DefaultValue></a></MetadataDefaults>

So the structure for a particular rule is following:

<MetadataDefaults>
  <a href="path to folder">
    <DefaultValue FieldName="column name">Default Value</DefaultValue>
    <DefaultValue FieldName="column name2">Default Value2</DefaultValue>
    {... more columns}
  </a>
  {... more folders}
</MetadataDefaults>

Example of Power Automate Flow Action:

URL:

 https://<<contoso>>.sharepoint.com/sites/<<siteName>>/_api/web/getFolderByServerRelativePath(decodedUrl='%2Fsites%2F**SITENAME**%2F**LIBRARY**%2FForms')/files/add(overwrite=true,url='client_LocationBasedDefaults.html')

Body:

{
<MetadataDefaults><a href="/sites/SITENAME/LIBRARY/folder1/subFolder1"><DefaultValue FieldName="TextColumn">SubTest</DefaultValue></a><a href="/sites/SITENAME/LIBRARY/folder2/subFolder2"><DefaultValue FieldName="TextColumn">SubTest2</DefaultValue><DefaultValue FieldName="DateColumn">2025-05-01T07:00:00Z</DefaultValue></a></MetadataDefaults>
}

Using this method please remember that the file is overridden, so to update the values you need to get the current values, add your new ones and then update the file.

PA Action


Replace contoso, siteName, SITENAME, LIBRARY, and your XML in body.