Read File from document libaray - InfoPath Dev
in

InfoPath Dev

Read File from document libaray

Last post 07-14-2013 02:34 PM by Patrick Halstead. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-12-2013 03:04 AM

    Read File from document libaray

    hi, i need urgent help,i have full trust info path browser enable form. I need to read the document form document library and assign to the file attached control in the form. i am using InfoPathAttachmentEncoder class. 

    i need to do this programatically. i have successfully upload file to the document libarya form the info path form , but i getting issues in reading it form the library.

    please provide any link which can help me to sort out this.

     

  • 07-12-2013 12:22 PM In reply to

    Re: Read File from document libaray

    no answer :). i can do it by adding customize SharePoint wcf service, but i though there migh be some workaround.

     

  • 07-13-2013 01:07 PM In reply to

    Re: Read File from document libaray

    Hi Abdul Aziz,

    If you need urgent help, you should call us and pay for our time.

    If not, please be patient. We respond to 90% of all posts. Sometimes it takes a few days or a week though.

    Certainly saying your request is urgent will make us ignore you. Since you are not following the protocol - pay people if you need urgency. For free stuff, please don't expect people to bend over backwards to spend their valuable time to help you in an urgent fashion. That's just rude.

    Now, to answer your question...

    First of all. Full trust forms are not a best practice. Less than 5% of all forms out there should be full trust. If you are using ShP 2010 you can use the file attachment control (out of box) to attach documents. That can be published to browser just fine as Domain Trust. No code needed. Please do that and stop writing code.

    We have lots of demos showing this, for example the YouTube video I did in February of 2012 shows attaching an image and converting it to a link. That demo uses our qRules plugin (which is code, but publishes domain trust just fine). You don't need that for what you are doing though. Just use stock file attachment.

    If you are doing ShP 2007, the control doesn't exist. In that case, I suggest you use a hyperlink control and default it to the document library where you want people to select the form. You can then use a dropdown to list the files in the doc lib and have them select one of those. Then, you have a rule that appends the selection to your hyperlink and voila you have a form that references a file in a doc lib. No attachment, no code, all just stock InfoPath out-of-box domain trust.

    Life is easy. Just smile and have a good one.

    Patrick Halstead
    Project Manager at Qdabra
  • 07-13-2013 09:01 PM In reply to

    Re: Read File from document libaray

     Hi and Thanx for the reply, let me tell you the scenario clearly.

    I attached a document in the info path, that document upload to our doc libaray.let say it is our request form.

    In the other form i need that document to be visible to user which was attached in the request form.

    I am not simply submitting form to the code, i need some bussiness logic to be there while addin items to be there in the list. In my case I am making a custom application.

    I guess for info path we can only submit data to one list at a time. i.e. submit option.

  • 07-14-2013 02:34 PM In reply to

    Re: Read File from document libaray

    InfoPath can submit data to more than one list or library but requires some tricks with CAML, or qRules SubmitToSharePointList. Search on those topics my friend and you will find lots of examples.

    I still do not understand your scenario. You say you have a form where a document is attached and that document is uploaded to a doc library. How are you doing that? Custom code? I strongly recommend moving away from custom code in your InfoPath forms as it will be costly to maintain when you migrate your form, change the data source, or extend it in the future. My recommendation is to use a common library, like qRules to do this. SaveToSharePoint is the command you should look at.

    Once the attachment is uploaded to your doc library, your second InfoPath form can refer to it using the file attachment control which should support allow navigating to a SharePoint site, but the problem with that is that you want to refer to it, not attach it. Right? So, I recommend using a hyperlink control to the document instead. You can have a dropdown list box bound to a data connection that lists all documents in that library. When the user selects one, you have a rule that concatenates the URL for the library with the title of the document. Then, the hyperlink can be clicked to open up the document from the document library.

     

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.