SharePoint: Can a Content Type have an attachments collection property?

Tag: sharepoint Author: wuyu1314520 Date: 2009-08-04

I have a content type, that will store text site columns, and I want to know if its possible to have an attachments collection? This I guess could be stored in some folder structure.

Best Answer

All content types that don't inherit from Document automatically have an attachments collection: SPListItem.Attachments

The Attachments property does not apply to document libraries and returns an ArgumentOutOfRangeException exception if applied to a document library.

comments:

Sounds good, can a list item also have a site Column which is of type file?
No, your only file attachment options are a "list item" with Attachments or a "document" with a single attachment that gets special treatment. And of course, with a custom field type you can do just about anything.