我正在开发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);
我如何将当前文档放在这里。感谢您的帮助。问候
保存文档后,** ActiveDocument ** Path属性具有完整路径
attInfo.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes(**Globals.ThisAddIn.ActiveDocument.FullName**));