Using qRules' SaveToSharePoint Command Without SharePoint - Jimmy Rishe
in

InfoPath Dev

Jimmy Rishe

Using qRules' SaveToSharePoint Command Without SharePoint

qRules provides a handy command called SaveToSharePoint, that allows you to save attachments in your InfoPath forms to a SharePoint server, to reduce the size of your XML forms, and allow these files to be accessed without opening up your forms in InfoPath.

But in spite of its name, you don't have to have SharePoint to take advantage of this command. Using a module called WebDAV, it's possible to configure an ordinary IIS website to allow files to be saved to it.  This tutorial goes through a few simple steps for setting up WebDAV, to accept files saved via the SaveToSharePoint command.

 This tutorial assumes the three following requirements:

  • You will be saving the files to a server running Windows Vista, Windows Server 2008, or Windows 7
  • You already have an IIS website running on your server
  • Your website uses Windows authentication

Without further ado, here's how to set up a file repository where you can save your files.

1.  Ensure you have WebDAV installed on your server.

Open up IIS manager, and in the Connections pane, expand the Sites folder and click the node for your website.

A number of icons should be shown in the center of IIS Manager.  Look in the IIS section of this group of icons and look for an icon called WebDAV Authoring Rules.  If this icon is present, please skip to Step 2.

If you see no WebDAV Authoring Rules icon, you will need to install or enable WebDAV.  Please consult the corresponding Installing WebDAV section of the following page to get WebDAV setup on your server.  Vista and Windows Server 2008 users should consult the section for IIS 7.0.  Windows 7 users should consult the section for IIS 7.5.

http://learn.iis.net/page.aspx/350/installing-and-configuring-webdav-on-iis-7/

Once you have installed WebDAV, please close and reopen IIS manager, and ensure that the WebDAV Authoring Rules icon is available now.

2.  Create a virtual folder for your saved files.

Since you don't want to allow users to save files just anywhere on your site, the next step is to create a virtual folder where files can be saved to your site.  Right-click your site's node in the Connections pane, and select Add Virtual Directory...

Give the virtual directory a name (this is the subdirectory of your site where files will be saved), and create and/or select a physical folder on the hard disk to which this folder will correspond.  Click OK.

3.  Enable WebDAV on the new virtual folder.

Select your site again in the Connections pane, and double-click the WebDAV Authoring Rules icon.  Click the Enable WebDAV text in the Actions pane to the right to enable WebDAV for the site.

Now, select your new virtual folder in the Connections pane so that the top of the center pane says FolderName Home, where FolderName is the name of your new folder.

Double-click the WebDAV Authoring Rules icon again.  Now click the Add Authoring Rule... text in the Actions pane to create a rule to allow saving and accessing files in this virtual directory.  For simplicity, just add a simple rule that allows Read, Write, and Source, for all content and all users.  Click OK.  You have now set up your virtual directory to use WebDAV.

4.  Set up an index for your virtual folder.

One last step to allowing SaveToSharePoint to work on your site is to set up an index for your new virtual directory.  By default, IIS prevents making requests directly to folders on a site, and this will cause SaveToSharePoint to not work.  You have options.

a.  If you would like users to be able to see a list of the files in the folder using a browser

Again select your new virtual folder in the Connections pane of IIS Manager.

Double click the Directory Browsing icon in the IIS section of the central pane.

Click the Enable text in the Actions pane.

b.  If you do not want users to see a list of the files in the folder

Open a new instance of Notepad

Without entering any text, save the file with the name index.htm in the physical disk location that corresponds to your virtual directory

This will cause a blank page to be displayed if anyone navigates to this directory in a browser.  If you like, you can instead use a file with HTML, to display a certain page to users who navigate to that directory.

 

If the above went successfully, you should now be able to use the SaveToSharePoint qRules command to save InfoPath attachments to your site.  Just specify the URL to your virtual folder in the command's url parameter:

SaveToSharePoint /url=http://intranet.site/InfoPathSaveFiles/ /xpath=/my:myFields/my:files/my:file

Best of luck!

Comments

 

ErnestoM said:

If you are using IIS 6.0, check out Jimmy's follow up blog entry:

www.infopathdev.com/.../webdav-security-and-webdav-on-iis-6-0.aspx

June 23, 2010 7:24 AM
 

Mel Balsamo said:

For instructions on how to use the SaveToSharePoint command with your SharePoint server, refer to the document found here:

www.infopathdev.com/.../entry59151.aspx

September 22, 2010 7:48 AM
Copyright © 2003-2014 Qdabra Software. All rights reserved.
View our Terms of Use.