2

I have a custom list form which implements out of the box attach file functionality to add attachments to the list item. Upon save, the attachments are saved to the item. But before saving the list item with attachments, I would like to validate for the following:

  1. Limit only one attachment per list item.
  2. Validate for attachment size which should not be more than 250KB.

Please let me know if the above can be implemented. Thank you.

0

To get this information I would recommend you to implement a SPItemEventReceiver.Item.AttachmentAdding Event Receiver. When a new attachment will be added you can cancel this event when there is already a attachment on the list item. For validation of the file size you might need first upload the attachment and delete it, when it is to large.

The items will be uploaded to SharePoint independently after the list item have been created.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.