-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Category
[ ] Enhancement
[X] Bug
[X] Question
Version
Please specify what version of the library you are using: 3.22.0
Expected / Desired Behavior / Question
When using ListItemAttachment to add or remove an attachment to the list item that the updated etag would be returned so that the dynamic edit form will be able save.
Observed Behavior
When using the ListItemAttachments control in edit view for a DynamicForm to either attach or remove files, upon save the following error is received (with various different values for ETag in the message of course).
Error making HttpClient request in queryable [412] ::> {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.ClientServiceException","message":{"lang":"en-US","value":"The request ETag value '"4"' does not match the object's ETag value '"66b3501f-75a0-4716-8884-b2d93681eded,5"'."}}}
Steps to Reproduce
Basic set up of with component. Open an existing item. If there is no file attached, select Add Attachment, if there is a file delete it. Edit the Title. Select Save.
I see in the network logs that the calls to the endpoints used by ListItemAttachment don't return the ETag for the associated list item.
_api/web/lists(@listId)/items(@itemid)/AttachmentFiles/add(FileName=@filename)
_api/web/lists(@listId)/items(@itemid)/AttachmentFiles
_api/web/lists(@listId)/items(@itemid)/AttachmentFiles/getByFileName(@filename)/RecycleObject
###Question or suggested workaround
It is probably Microsoft's issue that updating the attachments update the Etag for the item, but don't report it. So if there isn't a way to get that information directly from the Attachments control, is there a way for the ListItemAttachments to raise events such as onComplete or onChange or some such. I see there are several private events in the class.
As a workaround we are setting respectETag={false} on the DynamicForm, but that can cause other issues.