SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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 '11 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 '11 at 6:34

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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