Check that Form Out (or in) Automatically! - Hilary Stoupa

InfoPath Dev

Hilary Stoupa

Check that Form Out (or in) Automatically!

I've wanted to blog this for a bit, but it finally reached a tipping point this week when I saw that two posts on the forum and an email in my inbox all needed a hand with the same subject.

You can't work with InfoPath and SharePoint for long before you find that some SharePoint Lists web service methods just don't play fair with InfoPath data connections (yeah, GetListItems, I'm talking to you). But don't let one or two bad apples spoil your barrel, because some of those web service methods work wonderfully with InfoPath. And that is what this post is about, leveraging some of the yummy good methods, and ignoring the bad.

So, you know how when you open a form in client from SharePoint, and someone else has it open, you get a little message letting you know and offering to open a read only copy? But no such love for browser forms.... Imagine, what if your browser form checked itself out with no effort on your user's part at all? And then, when they submitted, it checked itself back in?

This is no early winter pipe dream. You can do this with the above-mentioned IP-friendly web services. Before we dive in, I should mention I'm leveraging some functionality that is only available in SharePoint 2010  (and only seems to work correctly in forms opened in the browser) to find out if the form is already checked out (I underline this so you don't walk all the way through this and then fuss about your version of SharePoint being the wrong one or wonder why it doesn't work in client). I'm sure there are ways to do this in 2007, or in client, so don't let that stop you from giving this a try, but I did want to warn you upfront that your path may be different. Or bumpy.

Check Out Data Connection

In your form, add a receive data connection to the Lists web service for your SharePoint server (http://server/_vti_bin/Lists.asmx  with server replaced with your actual server name). If in doubt,  test your URL in your web browser -- you expect to see a page like this:

Lots of stuff to check out there, but we need to focus. So, back to your form. Receive connection:

SOAP service:

Location of the service:

Select the CheckOutFile operation:

Note the parameters, but don't bother your purty head filling them out:

Ignore the next dialog, and in the final window, de-select the annoying checkbox that ALWAYS wants to get your data on load:

Check In Data Connection

Do everything you did in the section above a second time, with the following exception: select the CheckInFile operation:

You should now have two data connections in your form:

Form Library Data Connection

Create a data connection to the form library the form will submit to. In my case, since I am working with a brand new form, I need to publish my form and create my library. Your form may already be published. This article has more info on how to do this. Be sure you are either using a form field for the form name, or some unchanging piece of data you can get again, as you will need to know the form's name to check it in or out.

After your form is published to a library, create another data connection. This one will also be a receive connection, but this time to a SharePoint List or Library:

Use the URL for the server your form is published to, and select the library the form is published to... Here is the super important bit... select the checkboxes circled in red below:

Make sure you've included the field with info as to who the form is checked out to and indicate you only want data for this form. In this instance, get the data on load -- it will only be a single row.

Make the Magic Happen!

Form Load Rules

Our "Check Out" functionality gets added to the form load rules. Our first rule needs to make sure the form is not already checked out, so it will have a condition that the form is not currently checked out to anyone. Remember, the data connection to the form library is querying on form load, so it will tell us if our form is already checked out:

What you decide to do at this point is up to you -- you may wish to switch to a read only view or you may have a form field for user messages in your form. But regardless of the action for this rule, you need to make sure you've selected to not run any aditional rules if this condition is met:

For your second rule, you'll need to have a condition so that the check out rules only run if the form has been submitted to the library. One way to do this would be to see if the Checked_Out_To field is present:

For your actions, you are going to set the values for the CheckOutFile data connection, then query using that connection. The first parameter is pageUrl:

and it needs to be set to the URL of your form's XML file. You'll probably need to use a concat formula to create the full URL to the XML file:

In the screen shot above, the Title attribute is a field in my form where I am storing the name of the form.

Next, set the value for checkoutToLocal. Here is where MSDN is just invaluable. Let's go see what the options are for that bad boy, shall we?

Given this info, we'll set that field to true:

Having checked MSDN, we know that we can leave the final parameter blank. Our final action for this rule will be to query using a data connection -- the CheckOutFile data connection:

You can add another rule if you like that leverages the CheckOutFileResult and provide your user with information on how to proceed if the result is false for some reason.

Form Submit Rules

You probably already have all kinds of submit stuff happening in your form -- it must at least submit to a SharePoint library, or you would have had no interest in this post and would never have gotten this far. You need your form to be submitting via rules to add this new functionality to check the form in, however. If you haven't already got your form set up that way, modify the submit options. Here's some details -- I'll wait while you fix that.

We need to add to our submit rules -- we have to set the parameters for the CheckInFile data connection, and then we need to execute the query.

First, we set the pageUrl. This should be familiar to you, as we just did this in our form load rules.

Set the comment as you see fit -- it might be nice to set it something like "Auto check out and in from form" so that when someone reviews the history it is clear what was going on.

And, for the CheckinType, back to MSDN:

I'll not pretend I know what the difference is between a "minor" or "major" checkin. I imagine "overwrite" does what it says on the box. At any rate, set that field to 0, 1, or 2

Finally, add an action to run your CheckInFile query. As with checking out, you can check the CheckInFileResult and handle any errors if desired. Publish your form again, make sure your form library is set to always open in the browser, and sit back and relax while your users shower you with accolades.

EDIT: The awesome SharePoint guru, InfoPath MVP & all around good guy Clayton Cobb filled me in on the different checkin types. He says:

those values are referring to minor and major drafts like 1.1, 1.2, 1.3 (minor) and 1.0, 2.0, 3.0 major). First, versioning needs to be turned on, and then it needs to be set to minor or major for these to be in sync.

Thanks, Clayton!

EDIT The Second: Who loves you? Qdabra loves you.... and we now have an XTP with this functionality that will make it even easier for you to implement this functionality in your form!



kriyas said:


Thank you very much for blogging.

Can you please advise is't applicable for Infopath 2007 version?

Or Infopath 2007 checked out function comes with out of the box?

Please advise.

November 30, 2010 7:28 AM

ewnash said:


I'm able to follow your logic but I have a problem with browser-enabled forms.  As you're no doubt aware, when a user opens a browser form for editing, subsequent users have no way of knowing that their edits will be lost.  The InfoPath client is smart enough to prevent this, any suggestions for leveraging your methods here in browser forms?

Thanks in advance.


December 8, 2010 8:01 AM

Hilary Stoupa said:

Hi --

Kriyas -- the issue with IP 2007 is that it may be tough to get the ShP item ID from your form library. If you can do that, you can use this method....

Eric, this was written for browser enabled forms. What part fo the logic are you having trouble with? It is meant to help you solve the problem you are outlining -- if you check the form in and out automatically, and check to see if the form is checked out on open, you can redirect the user to a "read only" view with a message about the form being checked out....

December 15, 2010 3:20 PM

Ozgen Bektas said:

Dear Hilary;

I want to allow multiple user to edit the infopath form at the same time. For instance there are A and B users that open the X infopath form at the same time. Both edits should be saved. Can you please inform me to provide this? I also read that it can be done using javascript code...

February 15, 2011 2:19 AM

Hilary Stoupa said:

Hey, Ozgen -- sorry, I don't know how to do that. You have a reference for javascript that will let you do this? You may want to try to convert that to managed code so you can use it in a browser form (if you are using browser forms...)

February 25, 2011 8:24 AM

Mel Balsamo said:

Using data connections in browser-enabled InfoPath form templates introduces some potential issues which

May 16, 2011 1:05 AM

abc123 said:

This is exactly what I want but I'm getting an error, "An error occurred while trying to connect to a Web service." Can you please suggest why this might be happening. The Log ID is 5566. We also have a problem with User Profile Service. What can our farm admins do to fix this?

May 23, 2011 7:32 AM

cnorris135 said:

with a form that has code (qRules), does the form have to be published FIRST in order to see the Check_Out_to option?  Was wondering because based on what i understood, after you add the two data connections (CheckIn & CheckOut), i went to the Form Options (Open and Save) and did not see them there.  Are they under MyFields or another data connection?


November 4, 2011 12:53 PM

cnorris135 said:

i think i may have this one figured out.

November 7, 2011 4:35 AM

Cecilia said:

Hi Hilary,

I've gone through all the steps you've detailed but still seem to have hit a wall.

I do not require to check out the form within infopath (users will check out the form from the library).  I've created a new data connection for CheckInFile but nothing seems to happen when I click the Submit button (where the rules are applied).  I don't receive any errors, the form remains checked out to myself, and the version number also stays the same.

Have you come across this problem before?

Thanks in advance!

May 23, 2012 12:51 AM

Hilary Stoupa said:

Well, I'd think the issue on CheckInFile would be if your parameters were incorrect. So, be sure to verify that the pageUrl query parameter is being set to the full path of the file you wish to check in and that you've set the CheckinType.

Here's the MSDN page on the method:

May 24, 2012 12:02 PM

bobwbarnes said:


Very interesting stuff - do you know if this will work with Office 365. It seems to if I preview from InfoPath Designer, bu not so good from the browser - it's as if it does not like the HTTPS from the browser? Any thoughts?



July 9, 2012 7:57 AM

Hilary Stoupa said:

Hi - I've had ongoing issues trying to use SharePoint web services in browser forms in Office 365. I'd assume this won't work there.

July 17, 2012 8:23 AM

Suyin said:

I'm trying to implement your solution but at the point of Querying the CheckOutFile connection, I got an error. Our sharepoint environment is Load balanced and we also have https.

July 25, 2012 12:39 PM

Hilary Stoupa said:

Are you able to create the data connection in InfoPath? Or does that fail?

August 15, 2012 3:25 PM

Don Thie said:


I have a old 07 InfoPath form in a SharePoint 2010 library that opens in the client and is not web enabled. Is there a way that you know of that I can automatically check-in these forms after they are modified?

September 11, 2012 8:49 AM

Gennady Vanin (Геннадий Ванин, Новосибирск) said:


thanks a lot.

There are still some uncertainties/ambiguities how to follow your description straight without entering into guessing game.

Could you still possibly include the resulting (sample) template to check against?

September 12, 2012 11:50 PM

Michael Clark said:

This is exactly what I need.

We're on SP2010 and I can see a lot of functionality that can be added to our forms.

HOWEVER: I have had problems in the past with data connections in browser forms that do not connect to the site our form library is on.

Do you think the web service would fall into that category? The one time I tried this the form errored out with one of those great Microsoft messages. "AN ERROR HAS OCCURED"...

December 13, 2012 11:49 AM

Hilary Stoupa said:

Hi, Michael - sorry I'm slow to reply. Do you have access to your SharePoint logs? They may help you figure out why your web service data connections are causing errors.

January 10, 2013 3:00 PM

Patrick119 said:

Thanks for this post Hilary! It's extremely valuable.

A quick comment: I too have had issues with this sort of functionality while using browser forms in O365. I'm assuming this is why I was getting "An error occurred while trying to connect to a Web service (Log ID:5566)"

Howerver, it does seems to work while using InfoPath Filler (even in O365)

January 30, 2013 9:50 AM

Shlomi said:

Dear Hilary

It was nice and halpful to learn the implementation of chekin\out. Is there a solution when the entire browser is closed without a submit rules?

March 28, 2013 4:57 PM

deepan_999 said:

we are using SharePoint 2007 and Infopath 2010......will this method work for me?

April 10, 2013 7:59 AM

Hilary Stoupa said:

deepan_999 - it may, you just need to see if you have the option to return data "for this form only" - I don't recall if this works in ShP 2007 - and you'd need to save the form as IP 2010 compatible.

April 15, 2013 5:07 PM

deepan_999 said:

Hi Hilary, I was able to get SP2010 site and I have Infopath 2010. I created a test form and applied the rules. However, the first rule on load for if checkout is not blank does not seem to work. When I open the form for editing purposes, the check out to field remains blank. I am not sure what I am doing wrong? Any suggestions?

Thank you,


April 24, 2013 1:48 PM

deepmalanair said:

Hi Hilary,

Thanks for this valuable information. i tried with this.. but my form is giving SOAP error.

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

<detail><errorstring xmlns=">

in the very first function of Check out file.

May 27, 2013 4:08 AM

Stan Diamond said:

Hi Hilary,

Thanks, this worked perfectly for check out and check in.  Please do you know if there is a similar approach to marking a workflow task as complete so I that can add it as a rule to the button that does the check in?  I'm using SharePoint 2007.



July 1, 2013 9:13 AM

bsieloff said:

Hi Hilary,

I am working with your Check-in/out function listed.  I also have the XTP from your company, but your instructions were easier to follow.

The issue I’m having is that it works fine in the filer but not in the browser.  Is this as expected or should it work in the browser too?



SharePoint 2010 ent., InfoPath 2010, https://

August 2, 2013 4:11 PM

RohanRao said:

Got your logic of CheckOut in form load and your check in after clicking on submit, but what happens in case if the user closes the page itself i mean close button of the browser then the file would be still check out and no one could fill the form out

August 22, 2013 8:59 AM

Hilary Stoupa said:

Hey Bob - replied to you via email - I wrote this long enough ago that I don't recall all the details, but the beginning of the post indicates that where I tried it...

RohanRao - yup, you are right - there is almost always a way for users to shoot themselves in the foot. :)

September 4, 2013 10:13 AM

infopathdude said:


This article is great..I have used this in 2010 and worked great..Iam trying to use this in 2013 with web app which has claims based and i am seeing 401 unauth errors...Any advice?

Thanks a ton in advance

March 18, 2014 12:49 PM

bgrassie said:

Hi,  Hilary I am having an issue when I open the form it does not check it out.  I get a read only.  I then close form and reopen and it checks it out.  ANy help would be great....



March 24, 2014 8:09 AM

holdemryan said:

Hi Hilary, excellent stuff. Do you know if this will work for a SharePoint list with Infopath form used for submission?



May 12, 2014 6:29 AM

Post Links 05/14/2014 | dlowedown said:

Pingback from  Post Links 05/14/2014 | dlowedown

May 14, 2014 5:36 AM

ncjks said:

I was able to make the check-in part of this work in the IP Form Filler fat client. The URL\Comments\Type variables are all strings and IP requires that you use either String() or Concat() in the formula dialog, you can't just paste the desired string "like this" in the Set Field Value dialog; I actually had to open the formula dialog and use the correct function to be sure IP poked a string out to the lists.asmx web service. Very nicely written blog post, so thanks for that.

May 30, 2014 7:42 AM

Frith01 said:

I was able to get this working with InfoPath & SharePoint 2013 (Claims based auth), but had to tweak a few things ::

1.  Create Data connections to  Checkin / checkout  SOAP services


               b.   Select  Checkout     (repeat for checkIn, and UnDoCheckout )

2.  Create following rules :

               a.  Set a field value with the full URL to the current document   (Title is a static field populated on form open which assigns a timestamp to create a unique form name.  NOTE:  form name cannot contain special characters  , including the colon :  typically found in time stamps )


             b.  Set First parameter of checkout Data Connection

                  pageUrl = FullURLFieldName

c.  set Second parameter of Checkout Data connection

        checkoutToLocal = "true"

d.  Set Third parameter  of Checkout Data Connection  ( docs say Optional, but it is required )

         lastmodified =

 e.   Execute query to checkout document

 f.  Verify checkout by setting return value from query  to a field value.

                     (Checkout_Flag is just a form field )

g.  If checkout_flag is false,  switch view to just a button with exit , and a button with "cancel checkout"  which runs action to query  "UndoCheckout", after setting pageUrl to be FullURLPageField

Checkin works similarly, but change the  

CheckinType"    to  be  


as the formula, since it didn't like  "1" ,even though it says it is text.

August 1, 2014 12:54 PM

narahari said:

Thanks for the  post.

I am migrating infopath form from SP2007 to SP2013 one of the form contains the checkout(on page load) - Checkin(on submit click) functionality explained exactly above. I converted the Checkout  data connection to convert to connection file. In the udcx file i used authentication section. Checkout and checkin is working but the file is getting checked out to the user id specified in the authentication section instead of the logged in user.Environment using web browser form, Sharepoint 2013 on premise authentication kerborose. Any help.

November 14, 2014 10:33 AM

arronbey said:

Hi Hilary,

Thanks, this worked perfectly for check out and check in in the filler but not in the web enable form.

the issue in web enable form is the form was check out to system account instead of the user. but if i open the form in filler, it show the correct person name who open the form .

do you have any idea where should i configure to make it check out to the correct user?

Thank you!!!

June 1, 2015 10:49 PM

reqlow said:

Hi Hilary!

Thanks this very good solution! It helped me a lot!

I have some strange things:

My Environment is SP 2013 and IP 2013

Your method is working only if i created send (checkout and chekin) data connections not recieve, and i dont understand why...

Is there anyone who experienced similar problem?

Many thanks!

October 25, 2015 3:46 AM

Hilary Stoupa said:

Oh, interesting - I've not run into that. I'll be interested to learn if anyone else has had that issue. What happens if you use receive data connections?

October 26, 2015 8:14 AM

Laurie Wheeler said:

SharePoint 2013 and InfoPath browser forms require UDCX file to use secure store.. secure store using system credentials.  Is there any way  to transfer the control back to the user who opened the form after it has been automatically checked out?

March 3, 2016 10:57 AM

ask.shruts2007 said:

I have followed everything. I don't get any error while checkout but I don't see the document checked out as well. Could you please help me here to figure out how can I debug the issue.


May 18, 2016 9:31 AM

Hilary Stoupa said:

Shruti - I'd put the data connection query & data fields onto the form and add a button that executes the query to troubleshoot. You may want to start a new forum thread and attach your form to make it easier for someone to help you.

May 18, 2016 10:46 AM

ask.shruts2007 said:

Thank you Hilary for your valuable feedback. Actually I do have it all on my form. Please see the link to the new forum for details -

May 18, 2016 1:49 PM


I am using IP2010.  I constructed my form exactly as directed in Hilary's thread.  With my browser form I am getting "An error occurred while trying to connect to a Web Service.  My form is published and I get this error using filler or browser form.  I get the same error when I preview as well.  Using the URL in IE, server/.../Lists.asmx, I can open the Lists page as shown at the beginning of this thread.  I am a site owner but I do not have server admin rights.

Any ideas?


June 10, 2016 9:19 AM

Hilary Stoupa said:

So, you are using an on-premises server? Not Office 365?

June 10, 2016 10:51 AM


We are using SharePoint 2010 deployed at another office and managed by a server admin group.  We are not using Office 365.

June 10, 2016 10:58 AM

Hilary Stoupa said:

So - even in filler you get an error about connection to the web service? I wouldn't be surprised if this was just happening in the browser - because there are some server settings that sometimes need to be adjusted to allow a browser form to use some of these web services.

I guess I'd grab the correlation ID from the browser form error & ask the SharePoint Admin to check it - unless maybe in filler there is a Details button on the error you can click that would give us some information on the error?

June 10, 2016 11:05 AM


Hi Hilary,

I now realize I am getting different errors for filler and browser forms.  For the browser for I am getting the can't connect to web service error. However, when I switch to using the filler, I get the following error:

The query cannot be run for the following DataObject: CheckOutFile

InfoPath cannot run the specified query.

The SOAP response indicates that an error occurred on the server:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.

<detail><errorstring xmlns="">Parameter pageUrl is missing or invalid.</errorstring><errorcode xmlns=">

Here is the formula I am assigning to the pageurl from the CheckOutFile data connection: concat("", my:WR/my:EventTitle, ".xml")

I have added a pageurl field to my form and it is not being pulled in from the secondary CheckOutFile data connection

June 10, 2016 12:07 PM

Hilary Stoupa said:

Well, I'm sure you noticed my note about the issues with this approach in filler, so I won't reiterate that - but you may just want to drag the query fields for the data connection onto your form & add a button to execute it to test it.

As to your issue in the browser, you will likely need to talk to your SharePoint admins about getting the error from the logs and resolving it. On our test servers, we disable loopback check, but there are other, less insecure approaches your admins may prefer.

June 10, 2016 2:07 PM


Thanks Hilary.  I got it working in the browser form.  I think my problem was I didn't have the full path to the form library.  

June 13, 2016 3:11 PM

Yugeswaran Vasudevon said:

Hi Hillary

I'm using IP 2013 & SP 2013. I've done until the data connection.

But I couldn't find "Checked_Out_To" to add in Form Load Rules. Please guide me what will be the next step?

July 7, 2016 5:42 PM

Yugeswaran Vasudevon said:

Hi Hillary.. Please guide me on this.. need urgent help..

July 17, 2016 7:02 PM

About Hilary Stoupa

I wandered into development after working as a business process analyst for a global manufacturing company. I create InfoPath solutions for our clients as well as work as a developer on company tools that extend InfoPath. I've also been instrumental in creating the InfoPath Master Class training provided by Qdabra.

Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.