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

问题描述 投票:0回答:1

我正在开发word addin。我需要在现有的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);

我如何将当前文档放在这里。感谢您的帮助。问候

c# sharepoint ms-office sharepoint-2013 csom
1个回答
0
投票

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

 attInfo.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes(**Globals.ThisAddIn.ActiveDocument.FullName**));
© www.soinside.com 2019 - 2024. All rights reserved.