Question

As we can add list instances in element.xml, is there a way to attach an image in Attachments field?

Was it helpful?

Solution

Looks like a no.

I don't believe this is possible using Data for the ListInstance. I tried saving a list as a template including data which had a list item with an attachment. Then downloaded the STP, renamed to a CAB and extracted the manifest.xml. There wasn't any attributes which stood out and the STP also contained a file called 10000000.000 which I believe was my attachment. SharePoint is doing something behind the scenes, because of this I think the only approach would be to create the list item programatically using a Feature Receiver and attaching the file. An example of setting the attachment can be found here http://avinashkt.blogspot.com/2009/05/how-to-programmatically-attach-document.html

List Instance with data

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top