SharePoint 2013 Online - 添加附件:客户端对象模型

问题描述:

使用CSOM创建SP 2013联机应用程序。我在SP设计器中创建一个自定义ASPX页面,并将项目插入并更新到SharePoint列表。之前,List输入表单是在InfoPath 2013开发的,其中使用了文件附件控制。由于代码不是使用ClientContext重写的,有人可以告诉我应该怎么做?SharePoint 2013 Online - 添加附件:客户端对象模型

您可能想要查看SharePoint Stackexchange for SharePoint的特定问题。

List list = web.Lists.GetByTitle("listtitle"); 
ListItem item = list.GetItemById(1); 
var attachment = new AttachmentCreationInformation(); 
attachment.FileName = "fileName"; 
attachment.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes("streamFile")); 
Attachment att = item.AttachmentFiles.Add(attachment);           
context.Load(att);          
context.ExecuteQuery(); 

https://sharepoint.stackexchange.com/questions/144814/how-to-attach-files-to-list-item-using-client-object-model

+0

感谢您的建议。我需要有一个客户端(这里的jQuery实现,因为使用客户端上下文来读写项目到列表中,我可以将所有字段保存到列表中,我需要完整的代码(HTML和jQuery) – user2249258

+0

https://blogs.ibs.com/2016/06/07/adding-attachments-to-a-list-item-in-sharepoint/ –

+0

当然,这看起来不错,汤姆。我会执行这个。谢谢你的帮助 – user2249258