Hello,
I have the following problem:
we have a process where the user can upload files as an attachment. This attachments ar saved as attachment to a SharePoint list item.
These attachments are later on in the process attached to an email. If the email exceeds a given size, it cannot be send (email size too big)
Now I want to implement a check, that the process cannot be started if the sum of all attachments exceeds a given size.
I found no way to get the file size of the attachments. I found a way to get the file size with JScript, when the user uploads the file (it is visible in the file attachment control on the view)
So I have the possibility to get the single sizes and I can make a sum and save the total size to the list item (this is no problem up to here)
But the users are able to “delete” existing file attachments and I found now way to find the file size of the deleted files to substract it from my total file size…
I tried to put the file into the “file attachment controll” but I found no way to do this. Is this even possible? If I manage to do this in a rule I can read the file size with JScript again and substract it…
Any ideas?
With the SP API there is a way to get the file size of any attachment file like this:
{site_url}/_api/web/getfilebyserverrelativeurl('/path/to/List/Attachments/{ListItemID}/{filename}')/Length
But I found no way to “read” this into K2 (either a form or in a process?)
regards,
Johann