SharePoint Developer Center > SharePoint Products and Technologies Forums > SharePoint - InfoPath Forms Services > Submitting attachments contain in InfoPath form to a SharePoint List
Ask a questionAsk a question
 

AnswerSubmitting attachments contain in InfoPath form to a SharePoint List

  • Wednesday, October 21, 2009 8:34 PMSep23 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    So a SP doc lib, a SP list and an InfoPath form walk into a bar...err...wait sorry.

    Seriously though here is the deal. 
    I've got a bit of a problem.  I have a SP doc lib, a SP list and an InfoPath form with code behind.
    The IP form has a file attachment control that works.  Upon submission the IP form's code submits the form to the SP doc lib and to the SP List.  The attachment also get's attached to the list.  This works when I debug on my PC.
    The problem appears when the IP form gets published to the SP Site/server.  The form runs, files can be attached to the form, the form gets submitted to doc lib and list however the attachment doesn't make it to the list.  I don't know why.
    The form is fullly trusted and I believe I signed it correctly.

    Does anyone have any idea what I'm missing?  I think it is a security thing but not sure. 

    Thanks in advance.
    Sal
    MOSS 2007, Office 2007, IP 2007, C#

Answers

  • Thursday, October 22, 2009 2:49 PMSrinivas Varukala Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Sal,

    Since it is submitting to the library but not saving the attachment to the doc. library and also since its a full trusted form and digitally signed, this should not be an issue with security related to infopath.
    Did you put any debug statements (or write message in eventlog)  in your code and ensure there are not exceptions while extracting the attachment?
    This is the only way we can debug this.

    One more thing you can try is put the code between elevated privileges block.


    Srinivas Varukala

All Replies

  • Thursday, October 22, 2009 5:09 AMSrinivas Varukala Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    On the submit event or attaching an event reciever and using item added event you can extract the file and upload to sharepoint list programmatically.

    For information on the extraction of the attachment from an infopath form xml please read
    http://spappdev.blogspot.com/2009/03/programatically-extract-attachments.html
    http://blah.winsmarts.com/2008-8-InfoPath_2007_-_Extracting_those_pesky_Binary_attachments.aspx
    Srinivas Varukala
  • Thursday, October 22, 2009 1:38 PMSep23 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Srinivas,

    Thanks for the advice but I am able to extract the attachment with my code when on my local pc running in debug mode.  That's not the problem actually.  The code doesn't run correctly when the form is published to the server.
    Does that clear it up further?

    S
  • Thursday, October 22, 2009 2:49 PMSrinivas Varukala Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Sal,

    Since it is submitting to the library but not saving the attachment to the doc. library and also since its a full trusted form and digitally signed, this should not be an issue with security related to infopath.
    Did you put any debug statements (or write message in eventlog)  in your code and ensure there are not exceptions while extracting the attachment?
    This is the only way we can debug this.

    One more thing you can try is put the code between elevated privileges block.


    Srinivas Varukala
  • Wednesday, November 04, 2009 4:49 PMSep23 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Srinivas,

    Thanks for the added hints/advice.  I went a different route with this opting to get rid of the SP list and just keeping the attachments in the IP form in the SP doc lib.

    If I have time I will try your what you advised.

    Thanks,

    Sal