简体   繁体   English

如何将当前 Word 文档附加到新的 Sharepoint 2013 列表项

[英]How to attach a current Word document to a new Sharepoint 2013 list item

I am develop a word addin .我正在开发一个单词插件 And i need create a new item in a existing Sharepoint list, with the current document like attachment.我需要在现有的 Sharepoint 列表中创建一个新项目,使用当前文档,如附件。

var attInfo = new AttachmentCreationInformation();
attInfo.FileName = "Test";
attInfo.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes(**here my current document**));
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem["Title"] = "My New Item!";    
oListItem.AttachmentFiles.Add(attInfo);

How i put my current document there.我如何将当前文档放在那里。 Appreciate your help.感谢你的帮助。 Regards问候

保存文档后,** ActiveDocument ** Path 属性,有完整路径

 attInfo.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes(**Globals.ThisAddIn.ActiveDocument.FullName**));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用SharePoint 2013中的REST API将附件文件附加到列表项 - How to attach a attachment file to a list item using REST API in SharePoint 2013 如何通过无缝身份验证从 microsoft word 2013 插件在 office 365 sharepoint 2013 站点中保存文档? - How to save document in office 365 sharepoint 2013 site from microsoft word 2013 addin with seamless authentication? C# 从 SharePoint 2013 文档库中检索文档列表 - C# Retrieve Document List From SharePoint 2013 Document Library 如何在SharePoint 2013中检索当前用户的声明 - How to retrieve claims for current user in SharePoint 2013 错误将项目添加到SharePoint 2013中的列表项“ InvalidOperationException未处理” - Error add item to list item in Sharepoint 2013 “InvalidOperationException was unhandled” SharePoint中。 如何获得列表项的“新”标志? - Sharepoint. How can I get the “New” flag of a list item? 如何将事件接收器附加到 sharepoint 中的自定义列表? - how to attach an event receiver to a custom list in sharepoint? 如何在C#中使用SharePoint Online 2013 Rest API删除列表项 - How to delete list item using SharePoint Online 2013 Rest API in C# 如何使用 SharePoint 2013 事件接收器按正确顺序检索列表项附件 - How to retrieve list item attachments with SharePoint 2013 Event Receiver in correct order sharepoint 2013 使用列表模板 C# 创建文档库 - sharepoint 2013 create document library using List Template C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM