microsoft-365-community icon indicating copy to clipboard operation
microsoft-365-community copied to clipboard

In a list with versioning enabled, attachment changes are not versioned

Open zshane15 opened this issue 3 years ago • 3 comments

The trivia item "In a list with versioning enabled, attachment changes are not versioned" should be revised.

This documentation appears to be incorrect or misleading. When versioning is turned on for a list, newly added attachments always produce another version when saving. This can be seen when adding a new item or updating an existing item. SharePoint will create a version for the initial submission of the item, then a version when file is attached on the backend.

I have some Flows that are referencing version history to determine if the item should move forward in the process. However, the fact that version history is affected when uploading an attachment, is breaking my logic. I wish there was a way to determine a version which was created for the purposes of adding an attachment.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

zshane15 avatar Jan 26 '21 10:01 zshane15

@zshane15 - Have you looked at Run a flow when a SharePoint column is modified? I haven't used that with the attachments column, but maybe it will solve your issue? Let us know if it does.

In the meantime, I'll chat with @PatD about rewording the article to make that line clearer.

sympmarc avatar Feb 08 '21 14:02 sympmarc

@sympmarc yes I tried getting that action to work but the versions created by attachments are really messing things up. There is no reliable way to programmatically return the last version which was created by the user changing data in relation to the current version.

For example, when an item is modified, I want to determine if the Status column changed. Without the any attachment changes I could simply just compare the triggerBody()?['Status'] to the previous version's Status. However, if the user uploaded 5 files and deleted 5 files, there are now 11 version created (1 for the data, 5 for removal, and 5 for upload).

In the version history data, there's nothing that says that a version was related to a file upload or removal. So when I try to use the Action for Get Changes, I have no way to know which version to compare it to.

The only way I can accomplish what I'm trying to do is just store a the previous version number in a separate column. But, at that point I might as well just store the Previous Status in a separate column (which is what I had to do). Not as elegant of a solution, but it works.

zshane15 avatar Feb 08 '21 17:02 zshane15

Maybe save the docs in a separate library rather than as attachments?

sympmarc avatar Feb 08 '21 20:02 sympmarc