Here is a simple console application. Which will loop through the all the lists.
This console loop through all the items in the list and fetch the count of files are attached to the list.
Here is the peace of code :
This console loop through all the items in the list and fetch the count of files are attached to the list.
Here is the peace of code :
foreach (SPList list in listColl) { if (list.BaseTemplate == SPListTemplateType.GenericList || list.BaseTemplate == SPListTemplateType.Links || list.BaseTemplate == SPListTemplateType.Announcements) { if (list.EnableAttachments) { int ItemCount = 0; foreach (SPListItem item in list.Items) { if (item.Attachments != null && item.Attachments.Count > 0) { foreach (var attachment in item.Attachments) { sAttNames.Append(attachment.ToString()); } ItemCount += item.Attachments.Count; } } } } }
No comments:
Post a Comment