RenderForm with SaveToSharepoint Command - Mark Tienzo

InfoPath Dev

This Blog



No tags have been created or used yet.


Mark Tienzo

RenderForm with SaveToSharepoint Command

Good day readers. Today we are going to talk about the SaveToSharePoint command and how you can use it in conjunction with the RenderForm command.  If you are not yet familiar with the RenderForm command, I suggest you have a look at my recent blog about it before continuing this one. 

This link will take you to RenderForm blog:

What is the SaveToSharepoint command?

            This is one of qRules advanced commands.  It lets us save a file, a set of files, an image, or a set of images to a SharePoint document library.  We need to have access to a SharePoint site and have a SharePoint document library created in advance in order to do this.

Let’s look at the parameters that we can use with the SaveToSharePoint command:

·         url: This is the URL where the SharePoint document library is located.

·         xpath: Here we indicate the xpath of the file or image attachment within the form.

·         dsname: This is the name of the data source where the file field is located, if it is not in the main data soure.

·         name: This is optional. We can specify a filename for the file if we want, and if not, the command will generate a name. If  name is omitted, it will also automatically add an extension for the files or images we attach

·         overwrite: Also optional, and the default if we omit this is to not overwrite. overwrite allows overwriting files with the same filename if set to yes. This is unavailable if you use the /dsnamews parameter

·         dsnamews: This is a data connection name for copy web service(optional).

·         dsurl: (optional) If we use the Copy web service data connection option with this command, the /url parameter needs to be to the same site that the data connection used. That is, if I created my data connection to the copy service using http://serverA but my command url is http://serverB (and therefore my form is published to serverA), the web method will fail. The /dsurl parameter can be used with the /dsnamews parameter to change the service url of the data connection to match the /url location.


Important points to remember when using this command:

·         The file or image field we create should have attributes with the names qRulesLink and qRulesFilename (both case sensitive) for this command to work.

·         If we need to upload more than one file/image, the source field should be in a repeating structure, but it should not be a repeating field within a repeating group.

·         If there are no attachment(s) the command will perform no action, so make sure you have a file attached or make a rule so that it only executes when the field is not empty or blank.

Let’s get started by creating a simple form with the SaveToSharePoint command only:

                Here is the form


                 The form consists of a file attachment control(FileAttachment), a textbox(FileName), a button(where the command will be placed), and another textbox(URL) to display the URL of the file saved.  Notice I encircled the qRulesLink and qRulesFilename attribute just to give emphasis to how important these attributes are to the command.

                On the button control, I added a rule to set the qRules Command field to:

concat("SaveToSharePoint /url= http://<servername>/MyDocLib /xpath=/my:myFields/my:FileAttachment /name=", FileName)

 If executed properly, this will send the file to the SharePoint library with the filename you entered, as seen in the picture above.  See how simple it is?


Now we are going to integrate this command with RenderForm.  I used the form from my previous blog but tweaked it a little to make the SaveToSharePoint and RenderForm command work together. Before working on the actual form changes, I created an xml file to use as a secondary data source to prevent unnecessary clutter in my main data source. The xml file looks like this in Notepad:



                                <RenderedForm qRulesLink="" qRulesFilename="" />




This file looks like this in the form when we add it as a secondary XML data source (notice I encircled the attributes again to emphasize their importance):


Now here is the main/default view we are going to use:

On each button control I used three rules one to render the view, the second to save it a SharePoint library, and the last to display the URL of the file saved.

1.       Set the qRules Command field to: RenderForm /allviews=true /resultxpath=/FormLogic/Values/RenderedForm /resultdestds=RenderForm

2.       Set the qRules Command field to: concat("SaveToSharePoint /url= http://<servername>/MyDocLib /dsname=RenderForm /xpath=/FormLogic/Values/RenderedForm /name=", my:FileName)

3.       Show a dialog box: concat("File saved to SharePoint library. URL is ", xdXDocument:GetDOM("RenderForm")/FormLogic/Values/RenderedForm/@qRulesLink)


If I clicked all the buttons and had them name each file True, Airlines, Sort, Basketball, AirlinesSortBasketball respectively, this is how it would look in the SharePoint library:

Now I hope you’re excited to see how the file will look when we open it.  Click on the filename, then save, then open (I am using Internet Explorer in this case). Here is what it looks like when we click on the topmost file which is AirlinesSortBasketball on a tab of Internet Explorer:

This is how we can use the SaveToSharePoint and RenderForm command together.  I hope you learned something from this.  Try it out to see how simple it is to use these commands in qRules!



tyty4u2 said:

I am looking at using this feature to Archive a form.  So once the form is marked completed, this will renderform as HTML and then submit to a document library leaving a hyperlink in the form.  

My question is what happens when there are images in the table of the form, such as a picture header?  I know image files themselves cannot be embedded in an HTML document so would they be put in a folder in the library or would they be ignored?

Thanks in advance!

February 3, 2013 9:03 PM

querighand said:

This app is emphatically able to support you restfully entertained during the bus or discipline drive to work! A curlPurchase a estimable curl to fun protect your investing. They commonly feature numerous fashions and colours to select from. Holiday is one thing that everyone needs to lionize and the destination of pick is one of the chief measures. Today's RC helicopters can be used by youngsters fun and adults of all years. But this secret plans yields yopu a lot of picks while representing this game. We survived faithful to  <a href = "">Listen To Your Customers. They Will Tell You All About Secondhand off of swings Where  </a> while my husband was locomoting to educate. You get fun one indicate for each original answer you hold as in, an answer cipher else has.

Is this dad a hoarder? elder kindergarteners can likewise run and wax in the staff-supervised LEGO City Play Zone. at that place may level be a certain subject convoluted. He hit Italy's Marco Materazzi's chest with his caput. Some of the babe baby boomers opposed it, of course of study.

The firstkind is the toy rc helicopters which are quick to fly, full assembled, limitedfunctionality  <a href = "">andaluciapatina Healing Therapist Life Coach  </a> spine composition, still, the open of physical contact composition will not go for inkjet ink. have misses' night where you all paint your nails and do pedicures. It has now represented more than than a month since Facebook FB started out swopping as a public company. I needed to keep it and bring it out into the day and onto the streets," told Person.

One of the most efficient shipways of touring the large crater is by employing one of the Grand Canyon chopper tours. Your kid can do  <a href = " in the midst of  </a> fun with wooden craft control sticks, glue, substantial, construction composition and marks. so, customer joy at call overring with Amazon's as yet droneless services feature soared up ended the net year. The tapings were all either ours and already digitalised or donated explicitly for the purpose of destructing them. These stocks feature more in park than notoriety they re both vast gamers.

To which he answered: "No, I just kept an eye on, really interested and truly savoured myself. The show quality of the silver screen is splendid with  <a href = "">when you get backward home in our dreams limited  </a> true, dishonest auto dealers are an leisurely target. I didn't base you go, I meant "Let's go!" Ok. Let's counting numbers games one more time. One 27-year-old junior retrieved understanding the Civil War drama glorification in gamey school.

You can flush do your hair in some untamed coiffures or hair styles. Do you truly want to live in an online, make-believe planetary? At initiatory, she refused to get mired in the conversation, alleging: "I don't desire to have a struggle though." And ne'er forget to look what s up,  <a href = "">Revolutionize Your Subtotals With These Easy-peasy Tips bustle of financial business  </a> might be beetling subdivisions.

The original TV spot was ab initio aired for Saturday through with Monday and has now constituted pulled for now, he avered. That will only scotch a child. In some regions, extrasensory investigation teams will direct tours out on Halloween to do some ghost hunting of your own. happen the ground behind pavement kerbs, ask why vitamins have fillers, seem into the relative configurations of different beasts' animal foots. Apart from these bodily processes, fetching up a part-time job is as well a honorable activity for

July 28, 2014 11:17 PM
Copyright © 2003-2012 Qdabra Software. All rights reserved.
View our Terms of Use.