[英]Remote Event Receiver-How to get attachment of list item before updating or adding list item
I want to add restriction to upload only one attachment in list item.我想添加限制以在列表项中仅上传一个附件。 I implement attachmentadding event, but if user delete the second attachment, I am not able to get the latest attachment count.
我实现了附件添加事件,但如果用户删除第二个附件,我将无法获得最新的附件计数。
You can check the attachment count using CSOM code below:您可以使用以下 CSOM 代码检查附件计数:
List targetList = clientContext.Web.Lists.GetByTitle("List Name");
ListItem oItem = targetList.GetItemById(1);
AttachmentCollection oAttachments = oItem.AttachmentFiles;
clientContext.Load(oAttachments);
clientContext.ExecuteQuery();
Console.WriteLine(oAttachments.Count)
Get All Attachments From List Item in SharePoint using CSOM 使用 CSOM 从 SharePoint 中的列表项获取所有附件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.