How to limit the number of users in concurrently opening the infopath form created on sharepoint server? - InfoPath Dev
in

InfoPath Dev

How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

Last post 05-18-2011 01:54 PM by merjill. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 01-18-2009 07:56 PM

    How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    I am quite a newbie to infopath and sharepoint and I need to use these software for my college's final year project.......

    I know there is a default short term check out behavior provided by the SharePoint Server.However it seems that SharePoint would automatically provide short term check out to document files files like MS Word and Excel hosted in Document Libraries, but not infopath forms.

    I want to do something like when a user open the form, a second user cannot open, edit, and overwrite the form at the same time until the first user closed the form. How can I do so, either by code or is there any built-in setting avalilible?

    Thanks!
  • 01-18-2009 10:56 PM In reply to

    • Anuma
    • Top 25 Contributor
      Female
    • Joined on 07-20-2005
    • India
    • Posts 525

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Hi,

    If you are publishing infopath form to sharepoint and trying to open form from sharepoint. Bydefault second user will open the form in readonly. He can able to edit the form, but he cann't able to save or overwrite the form.

    Anuma Chinthapalli /
    http://www.GGKTech.com
  • 01-18-2009 11:01 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Just to make sure I understand, you want to ensure that forms that have been created cannot be modified in form libraries in SharePoint. If you are using MOSS 2007, you have the ability to force a checkout on that library. This way, users cannot make changes to documents unless they are checked out. If you are an administrator on that library, you can go to Settings ->Form Library Settings -> Versioning Settings and click on “Require documents to be checked out before they are edited.” Once you do that, your users can open the forms in the library and would not be able to make changes to the document unless it is checked out. Unfortunately, there is no prompt to this effect when your users open the document. If your forms are set to display in the InfoPath client, they will have to save it with a different name in order to save it back to the library. If the form is set to open in the browser, they will be prompted to check out the document when they try to save the document to the library.
    Janice Thorne Microsoft Certified Professional

    Qdabra / Streamline data gathering to turn process into knowledge
  • 05-13-2009 02:35 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    @Anuma I am not sure thats how Infopath form services work.. Any two person can open the form and edit it simultaneously. (my guess is when I open the form it basically creates a new instance of form, because if i have two intances open of same form and if I submit one form and delete it from form library, then submit other open instance, new form gets created.) @Janice While opening the form in browser, SharePoint does not prompt to checkout the file as I said above Infopath creates totally independent instance of form while opening the form in browser. Check out works when you edit the file but in case of Infopath it just creates new instance and hence never ask for checkout. But when i have checkout setting ON for my form library and do not checkout the file it does not update the file (my guess is infopath overwrite the file instead of updating existing file).
  • 05-26-2009 01:40 PM In reply to

    • bungee
    • Not Ranked
    • Joined on 05-26-2009
    • Posts 3

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Any idea with this issue? I'm also struggling with it:

    I have a single InfoPath form with a lot of information that multiple users will need to access to read and some of them will also need to update. I'm struggling to find a user-friendly way to avoid concurrent editing of the form. I find that the "require check-out" option is very badly integrated with Form Services.

    Indeed, if the user forgets to check out, he can open the form and make all his changes and it's only when he clicks on "save" that the form tells him that he needs to check-out before editing (in my case, the user shouldn't save as another file). On the other hand, if a user checks out the form and save his changes, no prompt suggests him to check in his form so there is a big risk that the user may prevent for a long time the others to update the form.

    It's strange that InfoPath 2007 doesn't have the ease of use that Word 2007 has with checking out, namely the prompt to check out a document once clicked and the prompt to check in the document once closed.

  • 05-26-2009 03:19 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    If you can write code in Infopath, you can automatically checkout form when user opens it and you can check in when he saves the form. You can call, list.asmx web service to checkout and check in the document. for reference : http://msdn.microsoft.com/en-us/library/lists.lists.checkinfile.aspx Note: for checkout, if you get an error, try passing string.Empty in last parameter.
  • 05-27-2009 05:59 AM In reply to

    • bungee
    • Not Ranked
    • Joined on 05-26-2009
    • Posts 3

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Thank you for your answer. I thought I couldn't write code to browser-enabled InfoPath form.

    Moreover, would there be a way to ask the user if he really wants to check out (in a Word 2007 way)? Because I expect multiple users to open the form at the same time just to read infos so I don't want the first of them to check it out and prevent someone who really needs to update info to be stuck.

     Thanks again!

  • 05-27-2009 08:33 AM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Yes, you can write code in browser enabled Infopath.Sorry, I am not sure about prompting user for checkout for Infopath document, i have never tried it or never seen it. What you can do instead is, always open the document without checkout in read only mode and give some button to make form editable and at that point checkout the form for user.
  • 07-22-2009 02:19 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    I'm not sure if anyones monitoring this post, but I'll give it a shot.  This is exactly what I want to do. 

    mayurnagda:
    give some button to make form editable and at that point checkout the form for user.

    I have some C# expirience and have spent the last month diving into InfoPath's advanced features, but I keep getting stuck, especialy when I want to work with SharePoint.  I want to use SharePoints Lock mechanisms and complex draft / final versioning system, but I don't want the user to have to know a 10 click sequence for everyaction, so its easier to embed everything in InfoPath and hide the toolbars in ShaePoint all together.

    Thats what I'd like to do, but I need to add a checkin and checkout code chunk to the edit and save buttons, effectivly pulling that element of complexity away from the user.  Since I want to use SharePoint versions for audit trail and I had no success pulling the infomation from versions web service I just made a link to the right site, and made it look like another button. 

    Eventualy this code will move to a custom tool bar and anything non-esential will be removed, but it seems there are always a hundred ways to do one task (which is good), and none are well documented (thats not good).  Are there more people out there using web services in button code, or and FormCode at all, can I find examples of this code in one place rather than hunting forever for the next 4 lines that might be helpful?  Just curious if I'm really this bad at hunting for answers online?

    My current problem is just having the code to check out and in the current form from its library, which never changes, the local user is the same as the sharepoint user.  If no one notices this post I might repost somewhere else.

     

    Thanks ahead of time to anyone who responds, this forum has been an amazing resource,

    Adam  

    Paisting code into here just doesn't work...  Need a formater, heres a paistbin link: http://pastebin.com/m1def4225

  • 09-15-2009 07:48 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Hi All,

    I solved my problem using SharePoint 2007 Websrevices, this is my Check Out Method, my biggest issue was editability since the this.ReadOnly Value was static you'll see I took a cheap way out by resaving the form, my code is specific to what to you will be an abstact thing called a "Defintion"  If someone has issues with this methodology of how I have my own readOnly fields in the XML or which buttons have which conditionals I'd be glad to answer if I have more time, I've spent time trying to acomplish this at many levels.  Most of which involve SharePoint features.

    /// <summary>

    /// Check Out the Definition.

    /// </summary>

    /// <param name="sender"></param>

    /// <param name="e"></param>

    public void btnCheckOut_Clicked(object sender, ClickedEventArgs e)

    {

    // Get the  Info:

    // Get Main Data Source.

    XPathNavigator nav = MainDataSource.CreateNavigator();

    // Store all nessisary fields in local variables.

    string Number = nav.SelectSingleNode("/Number", NamespaceManager).Value;

    string Name = nav.SelectSingleNode("/Name", NamespaceManager).Value;

    string Library = nav.SelectSingleNode("/Library", NamespaceManager).Value;

    string readOnlyControl = nav.SelectSingleNode("/readOnlyControl", NamespaceManager).Value;

    if (readOnlyControl == "False")

    {

    // Check if the form has already been Checked Out, (is no longer read only),

    // If it is then show a Message Box.

    MessageBox.Show("It looks like you already have the Definition Checked Out and may edit it.");

    }

    if (this.New)

    {

    // If the Definition has not been saved Save As.

    this.SaveAs(Library + Name + ".xml");

    }

    else

    {

    // Else, Check Out the Form:

    // Get Secondary Data Source.

    XPathNavigator checkOutFile = this.DataSources["CheckOutFile"].CreateNavigator();

    // Set the values needed for the Check Out method of the Web Service.

    checkOutFile.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:CheckOutFile/tns:pageUrl", this.NamespaceManager).SetValue(Library + Name + ".xml");

    checkOutFile.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:CheckOutFile/tns:checkoutToLocal", this.NamespaceManager).SetValue("true");

    checkOutFile.SelectSingleNode("/dfs:myFields/dfs:queryFields/tns:CheckOutFile/tns:lastmodified", this.NamespaceManager).SetValue("");

    // Execute the Check Out.

    this.DataConnections["CheckOutFile"].Execute();

    // Get the Result for checking.

    checkOutResult = checkOutFile.SelectSingleNode("/dfs:myFields/dfs:dataFields/tns:CheckOutFileResponse/tns:CheckOutFileResult", this.NamespaceManager).Value;if (checkOutResult == "false")

    {

    // If there's an error, (checkOutResult is false), Show a "Check Out Failed" Message.

    MessageBox.Show("Check Out Failed. \nThis can happen if someone else has the Definition Checked Out, \nor if you do not have access to the site or file.");

    }

    else

    {

    // Save

    this.SaveAs(Library + "Temp/" + Name + "_temp.xml");

    this.SaveAs(Library + Name + ".xml");

    // Set Read Only.

    nav.SelectSingleNode("/study/controls/readOnlyControl", this.NamespaceManager).SetValue(this.ReadOnly.ToString());

    }

    }

    }

  • 09-16-2009 06:04 AM In reply to

    • bungee
    • Not Ranked
    • Joined on 05-26-2009
    • Posts 3

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    Hi! Thanks for sharing your experience with us. For my part, we are to explore the possibility to avoid InfoPath and use ASPX forms instead. But I keep your solution in mind if we have to go back to InfoPath. Anyway, I'm sure this will be useful for a lot of us.

  • 05-18-2011 01:54 PM In reply to

    Re: How to limit the number of users in concurrently opening the infopath form created on sharepoint server?

    I was able to do this by doing validation on the Modified Date in the SharePoint form Library.  I did a CAML Query to get the Modfied date in the formLoading event, and when saving, I did another CAML query to get the currentLastModified Date.  I had a validating event on a saveMessage field to compare the two modified dates. If they were different, I raise an error.

     

    This blog post explains it: http://sharepointchic.blogspot.com/2011/05/infopath-2007-validating-whether-form.html

     

     

    http://sharepointchic.blogspot.com
Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.