sp-dev-fx-controls-react
sp-dev-fx-controls-react copied to clipboard
ListItemAttachments. How to rename the file before it is saved as an attachment.
Category
[x ] Enhancement
[ ] Bug
[ x] Question
Version
Please specify what version of the library you are using: [ 3.18.1 ]
Expected / Desired Behavior / Question
It would be great to have an opportunity to rename the file before it is saved as an attachment. There are a lot of cases where you need to rename file before it will be uploaded.
Thanks!
It's a common requirement to rename the uploaded files. So, this opportunity will be extremely helpful
Hi @bva999,
I'm not sure this is possible, since we're talking about list item attachments (and not library files).
Since we're bound to SharePoint REST API, if there's no endpoint to rename an attachment, I don't think we'll be able to do it.
Furthermore, in the native list item UI, there's no way to rename an attachment: only getting it or removing it.
Is this answers to your question?
Maybe I’m not formulate my question correctly. I mean rename the file before it is saved as an attachment. For example, I have a file DOC1.docx, when I am uploading it with our component, I have some logic for rename this file, before it is saved. I rename it as p-00-01/23.docx and save . The same possibility we have in DynamicForm - onBeforeSubmit handler.
Ok, so we're not talking about renaming them once uploaded but before the upload process, right?
If so, I think we could indeed think about an event handler just like the one you're refering to!
Maybe the issue title / content could be updated to be more specific regarding your request?