Here is an example on how we can limit the number of attachments per SPListItem. We need to write an event handler on the event "ItemAttachmentAdding". Lets straight away get into the example: public override void ItemAttachmentAdding(SPItemEventProperties properties) { if (properties.ListTitle == "List Name") { //Do not allow more than one attachment per List Item if (properties.ListItem.Attachments.Count >= 1) { properties.Cancel = true; properties.ErrorMessage = "More than one attachment is not allowed per List Item!"; } } } For the particular List, it checks for the number of attachments. If the ListItem already contains an attachment (Count = 1), it cancels the event and displays a custom message to the user.
SharePoint | SharePoint Online | Angular | jQuery | REST | JSOM | Power Automate | Flow | Power Apps