从Sharepoint列表中提取附加文件

时间:2011-03-17 20:36:06

标签: sharepoint-2010 attachment

有没有办法提取SharePoint列表中的所有附加文件?

1 个答案:

答案 0 :(得分:1)

您可以遍历每个列表项,并获取每个附件。

List<SPAttachment> attachments = new List<SPAttachment>();
SPList list = SPContext.Current.Web.Lists["My List"];

foreach (SPListItem item in list.Items)
{
    attachments.AddRange(item.Attachments.Cast<SPAttachment>());
}