SharePoint 2010 如何取得ListItem的Attachements

最近一个项目用到读取SharePoint ListItemattachments ,在网上找了很多资料终于知道了如何取得一个itemattachments,记录之,已被后用。

string sourceInitialName =  sourceList.DefaultViewUrl.Substring(7,index-7);//取得列表名称

SPListItem sourceItem = sourceList.GetItemById(SourceItemID);//取得Item

SPFolder sourceListAttFolder = sourceItem.Web.Folders["Lists"].SubFolders[sourceInitialName].SubFolders["Attachments"].SubFolders[sourceItem.ID.ToString()];
//取得item的附件所在文件夹集合 

//循环处理逻辑
foreach (SPFile AttFile in sourceListAttFolder.Files)
{
    byte[] binFile = AttFile.OpenBinary();
    string copiedFileName = AttFile.Name;
      ....
}

原文地址:https://www.cnblogs.com/dexter2003/p/2139148.html