Sharepoint: SPAttachmentCollection - a collection of what exactly?

Take the following code snippet:

SPAttachmentCollection attachments = item.Attachments ; 

What exactly is the SPAttachmentCollection? Most collections tell you that they are a collection ... but remember the golden rule of SharePoint - it’s right, if it can be broken, it already broke.

If you are interested that the SPAttachment object does not exist. So can someone please enlighten me, what is the object of attachment that I seek.

thanks

+3
source share
3 answers

http://www.binarywave.com/blogs/eshupps/Lists/Posts/Post.aspx?ID=26

"SPAttachmentCollection is just an array of strings representing the file name for each attachment"

+2

, . :

var attachments in item.Attachments;
foreach (string fileName in attachments)
{
    SPFile file = web.GetFile(attachments.UrlPrefix + fileName);
    // Do something ...
}
+18

: http://www.binarywave.com/blogs/eshupps/Lists/Posts/Post.aspx?ID=26

This tells you how to get to the file - besides the line, as Ian Kemp mentioned.

As the author of these rights, this is completely illogical and a pain in the neck, but I think ... Another reason MOSS stinks.

0
source

Source: https://habr.com/ru/post/1716115/


All Articles