I have an infopath 2010 form with attached code, so I have published it to a forms library as an administrator approved form. This form is linked to a site content type, and is used in a number of sites under the site collection.

I'd like to be able to determine the current forms library the form has been created in, either programtically or by setting a default field value. But I only seem able to determine the URL of the forms template library where the form is stored. Is there any way of getting the url of the library where the particular 'instance' of the form has been created?

  • I've had a look at using the savelocation property of the input parameters, which looks like it should work - it 'knows' whereto save a draft form to. But when I get the property it says a forms template library in the child site where I am running the library - but such a forms template library doesn't even exist!
    – Carlovski
    May 11, 2011 at 17:12
  • Can you please update your question with details of your submit data source? Doesn't this tell you where the form will be saved to in SharePoint?
    – Alex Angas
    Jun 1, 2011 at 6:34

1 Answer 1


This isn't possible directly, but there are two possible workarounds.

One is to use the query string that the form is accessed with. As you're already using code-behind it should be easy to add the code required (look at the InputParameters property described in the linked article). You could either use the out-of-the-box query string parameters, or create your own parameters and make users click your link.

The other is to design the solution in such a way that you are able to determine this from within the code. For example, perhaps you can use the path to the submit data source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.