in

InfoPath Dev

Refresh Data from Sharepoint

Last post 07-21-2008 02:24 AM by Tara_H. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-17-2008 03:12 AM

    • Tara_H
    • Not Ranked
    • Joined on 04-14-2008
    • Posts 3

    Refresh Data from Sharepoint

    I'm fairly new to this - what I'm trying to do seems like it should be very simple, but I can't get it to work.

    I have an InfoPath form that is published as a site content type to my Sharepoint site.  It is used to send submissions from one team to another.  When the form is initially filled out and submitted (using the browser), it sends an email to the second team with a copy of the form and the data, and also submits the data to the Sharepoint library.  This all works fine, and I can track data related to the submissions in various columns in the library.

    I have recently amended the form to allow users to add comments at the end of the submission, using a repeating control.  This also works fine if the form is only opened from the Sharepoint library, but most of the users prefer to deal with it through the emailed copy.  The issue I have is that when they open this form, any comments that have been added since the form was first submitted don't appear.

    All I need it to do is refresh the data relating to the open submission from the library, but I haven't been able to find a straightforward way of doing that.

    From what I have seen, I need to create a secondary data connection to retrieve data.  The problem is that 'comment' appears as a single field when I try to set this up, rather than a repeating field, and in any case when I try to retrieve the data using this, it doesn't display any of the added comments, which is what I need.

    I would be very grateful if someone can give me a step by step explanation of how to do this correctly, or at least let me know if I am taking the right approach!

    Many Thanks,
    Tara

  • 07-18-2008 08:19 AM In reply to

    Re: Refresh Data from Sharepoint

    Hello, and welcome, Tara:

    I think that maybe this isn't as simple as one would hope. If I have misunderstood your scenario, please let me know...

    Your filled out forms are in a SharePoint library but also emailed. The emailed version may not contain the most recent information. The reason you can't pull your comments back with a connection to the library is that promoted properties don't allow for repeating fields -- you can merge the comments in a form together when you promote, but it will remain a single field. If that is an acceptable solution to you, you can have the SharePoint column hold the merged values of your comments field and add a section to your form that can hold those values.

    However, if it isn't an acceptable solution, I recently saw a sample in Patrick Halstead's book Developing Solutions with Microsoft Infopath. It involved using code to check and see if there was a more recent version of the form on SharePoint when a user opened the form from email, and then providing the user with a button to open the more recent version.

    I'm sorry I don't have a simple solution for you -- but I don't know that one exists. I think you'll either need code or to merge comments when you promote.

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-18-2008 08:38 AM In reply to

    • Tara_H
    • Not Ranked
    • Joined on 04-14-2008
    • Posts 3

    Re: Refresh Data from Sharepoint

    Hi Hilary,  thanks for the reply, and the welcome!

    That is exactly my scenario, it's unfortunate that there isn't a simple solution as I had hoped, but the second option sounds like it would work very well, providing I can train the users to always open the form from the email and not rely on the preview.  I will try the code-based solution - if you could provide any pointers or potential pitfalls I would appreciate it!

  • 07-18-2008 01:16 PM In reply to

    Re: Refresh Data from Sharepoint

    Well, I've not actually done this -- only read about it in Patrick's book (which I reallly recommend -- it is loaded with information and samples). The general structure suggested in his sample is to use the HEAD method of System.Net.HttpWebRequest to see if the file exists -- but I wonder.... What about adding a date to your form (you could just add it to the data source, don't have to display it) that gets filled with today() when the form is submitted, and the formula doesn't update....Then, you could compare that field to the modified date from your SharePoint library for the form.... and if the SharePoint version is newer, show a button to take the user to it.... Does that make sense?

    Hilary Stoupa / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-21-2008 02:24 AM In reply to

    • Tara_H
    • Not Ranked
    • Joined on 04-14-2008
    • Posts 3

    Re: Refresh Data from Sharepoint

    If it's not very complicated to get this kind of data back from the forms in the Sharepoint library, the most simple thing would probably be to compare the number of comments, since that's really the thing I'm interested in updating... I'll try and get some time to play around with this today and see if it makes a difference what specific data I'm retrieving.  Other than that I have the timestamp of when the form was submitted saved in the form name, so it would not take much work to retrieve that and use it for comparison, I would imagine.

Page 1 of 1 (5 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.