none
List Instance with data RRS feed

  • Question

  • Hello

    I need create a custom list with a feature and I must add an attachment to the list instance.
    I know add "normal" data:
    <Rows>
      <Row>
        <Field Name="Title">XXXXXX</Field>
         <Field Name="Value">XXXXXXX</Field>
       </Row>
    </Rows>
    But I do not know how add an attachment.

    Thanks

    HELEN
    Wednesday, July 1, 2009 9:05 AM

Answers

  • 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

    Hope this helps

    Dave
    My SharePoint Blog - http://www.davehunter.co.uk/blog
    • Marked as answer by Elena B Wednesday, July 1, 2009 2:08 PM
    Wednesday, July 1, 2009 10:53 AM

All replies