Store InfoPath file Attachments to Smart Object

Last post 02-09-2009, 1:35 PM by urvijaykumar. 15 replies.
Page 1 of 2 (16 items)   1 2 Next >
Sort Posts: Previous Next
  •  01-06-2009, 2:24 PM 27987

    Store InfoPath file Attachments to Smart Object

    HI,

    I would like to store the InfoPath file Attachments to Smart Object. I created the smart Object with following Fields ID,FileName, HyperLink (Link to sharePoint document Library Where it store the actual document) So my question is how can i fetch the file name from the InfoPath file attachment control without writing the code behind?

    Note: I tried with code behind, but when i open a form it is opening in InfoPath 2007 Client instead of opening in Web browser. I guess code behind has lot of issues to deploy.

     


    VijayKumar Yadavalli
    Filed under: ,
  •  01-08-2009, 7:01 AM 28030 in reply to 27987

    Re: Store InfoPath file Attachments to Smart Object

    I don't have an answer on the filename, but it is possible to open Infopath forms with code behind in a browser, but it does require a Sharepoint administrator to approve the form. Are you integrating with the form in a K2 process and then deploying the K2 process?


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-08-2009, 7:19 AM 28031 in reply to 28030

    Re: Store InfoPath file Attachments to Smart Object

    Thanks for your reply. Yes I am integrating the InfoPath form in K2. I also tried the InfoPath Form Code behind, but when i deploy using K2, Form is opening in InfoPath Client instead of Web browser. Last time i also tried with Deploying the form with Sharepoint Central administration it didnt work. Right now i havent remember what was the error i got at that time. Any way i will try one more time then i will update you the issues which i got.

    If i write a code behined in infoPath form, Is it possible to use K2 Classes to update the smart objects fields like fileName and File Content? If yes can you tell me what namespaces i have to Reference and sample code or steps if possible.


    VijayKumar Yadavalli
  •  01-09-2009, 12:05 AM 28073 in reply to 28031

    Re: Store InfoPath file Attachments to Smart Object

    1.       Deploy the process, which will updated InfoPath Form.

    2.       Go to the site where the form library resides

    a.       Click “Site Actions -> View All Site Content”

    b.      Click on “K2 Blackpearl InfoPath Templates”

                                                                   i.      The new template should be listed here.

                                                                 ii.      Right click on it and select “Copy Shortcut”.

    4.       Now in MOSS Central Administration.

    a.       On the menu click “Application Management”

    b.      Under “InfoPath Form Services”

                                                                   i.      Click “Manage form templates”

                                                                 ii.      Click “Upload form template”

                                                                iii.      Click “Browse” and paste the shortcut copied.

                                                               iv.      Click “Open”

                                                                 v.      Click “Upload”

    c.       Activate the new form to the site collection where the Form Library resides.

    5.       Back on the form library

    a.       In “Settings -> Form Library Settings”

    b.      Under Content Types click “add from existing site templates”. You need to activate content types under the "Advanced Settings" to see this section.

    c.       Select the new content type. It may be appended with a sequential number e.g. “PurchaseRequest6".

    d.      The form should now be able to open in InfoPath Form Services. If not, then there is something else wrong with the form that Infopath Forms Services does not like.


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-09-2009, 5:59 AM 28077 in reply to 28073

    Re: Store InfoPath file Attachments to Smart Object

    Ok I will give a try. What about namespaces i can use in InfoPath Form so that i can update the SmartObjects though code behind.
    VijayKumar Yadavalli
  •  01-09-2009, 8:18 AM 28080 in reply to 28077

    Re: Store InfoPath file Attachments to Smart Object

    Hi VijayKumar

    I am not sure if this would apply to your situation but I was able to get the filename after uploading the document to sharepoint without using code.  

    I noticed that the filename isn't required when uploading to a SharePoint Document Library SmartObject Create method.  However, the filename does appear in the document library after uploading even without specifying it (It appears that the SharePoint APIs are extracting the filename from the content header of the binary file when its uploaded). 

    In addition one of the return values of the SmartObject returns the filename which might be useful if you need the filename later on in the InfoPath form or within the workflow.

    Steps to reproduce.

    1.  Created the SmartObject for the document library using the Smart Objects Services Tester tool.

    2.  Integrated the SmartObject into the infoPath form selecting the Create method.

    3.  Added a fileattachment field to the infopath form and a button and configured the button's rules to call the Create method of the Smartobject I integrated passing only the fileattachment field as the value for the required content field.  I configured the return property FileLeafRef to populate the fileName field the file was uploaded to sharepoint.

     

    I hope this helps.

    Tim

     

  •  01-20-2009, 10:27 AM 28304 in reply to 28080

    Re: Store InfoPath file Attachments to Smart Object

    I wanted to add one thing to this post because I ran into a small challenge.

    I wanted to be able to use the GetList method of the smartobject to show a list of documents that I had uploaded with links to the documents.  The challenge I had was that the SharePoint ServiceObject does not give you a straight link but an xml formatted structure….<hyperlink><link>http://www.thelink.com</Link>...etc

    To get around this I used some of the built in string methods to parse down the structure and leave the link.  For the hyperlink properties add the following in the display and link to data sources:

    substring-before(substring-after(LinkToItem_K2_ServiceDefined, "<hyperlink><link>"), "</link>")

    -Eric


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-20-2009, 1:41 PM 28308 in reply to 28304

    Re: Store InfoPath file Attachments to Smart Object

    Here is a link to a little video I did to show it in action:

    http://www.k2underground.com/files/folders/videos/entry28307.aspx


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-20-2009, 1:48 PM 28309 in reply to 28308

    Re: Store InfoPath file Attachments to Smart Object

    Thank you very much for the video. It really solves my problem.
    VijayKumar Yadavalli
  •  01-20-2009, 2:58 PM 28311 in reply to 28309

    Re: Store InfoPath file Attachments to Smart Object

    Excellent...Glad I could help

    -Eric


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-21-2009, 9:12 AM 28347 in reply to 28311

    Re: Store InfoPath file Attachments to Smart Object

    Eric,

    Can i have the Sample InfoPath Form or project which you showed in the Video? I want to checke the Actions in the Upload button. 

     


    VijayKumar Yadavalli
  •  01-21-2009, 10:02 AM 28348 in reply to 28347

    Re: Store InfoPath file Attachments to Smart Object

    Attachment: DocUploadTest.rar

    I have attached the infopath form that I used in the video to this post. 

     A couple of notes about the stuff behind the upload button.  I created a doclink field and a docname field in order to store the return values from the upload which works good if you only want to upload 1 document in a more realistic scenario you might want to have a smartbox smartobject to store the URLs, file names, and some uniqueID for all the documents related to this instance of the form and then keep the uniqueID in the form somewhere so you can get the list of documents back at a later stage of the process.  In my simple case I just added the getlist method of the SharePoint smartobject so that I could retrieve links to all the documents that I uploaded however it will include all documents in that library rather than just the ones related to this instance of the form. 

     I hope this helps.

    -Eric


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  01-23-2009, 5:49 AM 28398 in reply to 28348

    Re: Store InfoPath file Attachments to Smart Object

    Another option to retrieve the list of documents for the particular process is to create a hidden column on the doc. lib. which will carry the ProcessInstanceID which can be stored in the Infopath XML. This way when performing the get list you could supply the ProcessInstanceID to only return the documents for a particular instance. This however would only work for attachments added at task events during the process and not work for attachments during the initial form view, because at this point the process has not been started and therefore you would not have a ProcessIntanceID.
    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
  •  02-02-2009, 10:14 AM 28538 in reply to 28348

    Re: Store InfoPath file Attachments to Smart Object

     

    I tried your video tutorial and its great. When i follow your video tutorial, I can able to upload the documents to root site, But i want to upload the documents to document library in a subsite and Every time i upload the document i have to create a Folder and then upload documents into it.

    How can i do this?

    Thanks


    VijayKumar Yadavalli
  •  02-03-2009, 10:31 AM 28551 in reply to 28538

    Re: Store InfoPath file Attachments to Smart Object

    The location of where the documents get uploaded is based upon the smartobject that is being used.  You can either create a smartobject for that particular library on the subsite and use that smartobject in the form or you can use the dynamic smartobject capability where you pass URL to a document libary in the input parameters of the Create method.  There is more info on this new dynamic capability here:  http://www.k2underground.com/blogs/fromthebench/archive/2008/11/21/leverage-existing-smartobjects-to-access-new-sharepoint-sites-created-with-templates-or-site-definitions.aspx

     I hope that helps.

    -Eric


    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
Page 1 of 2 (16 items)   1 2 Next >
View as RSS news feed in XML