Reputation: 3
I am trying to create a logic apps flow in Azure where if the file in a specific folder of sharepoint site is updated, i need to check the versioning of that file. Sepearate the major and minor version. If there is just a change in the minor version of the file, we don't need to do anything but if the major version of the file is changed/updated we need to store the file in the azure blob storage.
I have created a logic app flow:
The problem here is i need to get the previous version of the file so that I can compare the old and new version of the file from sharepoint and if a newer version is detected, store the newer version in azure blob storage.
Upvotes: 0
Views: 171
Reputation: 35915
If you want to ignore minor versions and continue with the workflow only for major versions, then just inspect the version number. If the version number ends in .0
then the last change created a major version.
By definition, any version that does not end in .0
is a minor version.
So, use the Split function, but get the element after the decimal point and check if it's a zero. Split returns text, so you may want to wrap it into an Int() function to get a number.
int(split(triggerBody()?['{VersionNumber}'],'.')[1])
Here is a file that I just changed and that is version 1.1
And here is the file published as a major version 2.0
Edit: Another way to achieve the same outcome is to use a trigger condition in the trigger. The condition in the screenshot below uses the formula
@contains(triggerBody()?['{VersionNumber}'],'.0')
The following screenshot shows two documents recently edited. The "Collaboration" file is still in a minor version, the "Controlled" document was published as a major version and triggered the workflow.
Upvotes: 0