Take the following code snippet:
SPAttachmentCollection attachments = item.Attachments ;
What exactly is SPAttachmentCollection a collection of? Most collections tell you what they're a collection of.... but remember the golden rule of SharePoint - that's right, if its possible to break, its already broken.
In case you're wondering an SPAttachment object does not exist. So could someone please enlighten me, what is the attachment object I am looking for.
Thanks
Note that the linked post complicates things. The preferred usage is found in the comments:
var attachments in item.Attachments;
foreach (string fileName in attachments)
{
SPFile file = web.GetFile(attachments.UrlPrefix + fileName);
// Do something ...
}
http://www.binarywave.com/blogs/eshupps/Lists/Posts/Post.aspx?ID=26
"the SPAttachmentCollection is simply an array of strings representing the file name of each attachment"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With