public void fnListAttachments(string site, string listName)
{
StringBuilder strAttachNames= new StringBuilder();
using (SPSite oSite = new SPSite(site))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList oList = oWeb.Lists[listName];
SPListItemCollection oListItems = oList.Items;
foreach (SPListItem item in oListItems)
{
SPAttachmentCollection attachmentscol= item.Attachments;
if (attachmentscol.Count <= 0) return string.Empty;
foreach (var attachment in attachmentscol)
{
strAttachNames.Append(attachment.ToString());
}
}
}
}
//return strAttachNames.ToString();
}
Sunday, February 5, 2012
Programmtically list all attachements in a List
Subscribe to:
Post Comments (Atom)
A sales engineer is someone who promise you a bridge, even when there's no river.
No comments:
Post a Comment