Search code examples
restsharepointsharepoint-2013document-librarysharepointdocumentlibrary

The default value for a column in not set when copy file using rest api (SharePoint 2013 standalone)


I am trying to copy files from one folder to another folder using SharePoint REST API. Some columns inside the destination folder have defined a default value. Even though the files are copied successfully, some files do not get the default value for the columns.

On a closer look, I found that the new office documents types (.docx, .xlsx, .pptx etc.) get the default values, while the old office document types (.doc, .xls, .ppt) do not get the values.

Also the old office documents get the values only when they are coming from a source folder which already contains the columns in the destination folder.

I am wondering why the old office documents do not get the values and if anything can be done.

Is it a bug in SharePoint Server or am I missing any configuration to make all files work? enter image description here


Solution

  • My understanding is that this is expected. Because you are copying files, the copy includes not only the file itself but also its metadata. If the file in the source folder doesn't have values in those columns, it does make sense that if you copy it to a destination folder, those same columns shouldn't have values either. Now, why some files (docx, pptx, etc.) do have values in the destination? Probably because of the SharePoint document parser feature (Document Property Promotion and Demotion). So in your case what you can do is, instead of copying the files, download/upload them using for instance code like this.