syntax to retrieve form path

J

John Sivilla

Is it possible to retrieve the location (ex. URL of sharepoint site) where
the form has been downloaded. I use the same form in many sites, and don't
want to have to go into each form to modify the submit location.

thanks,
 
S

Scott L. Heim [MSFT]

Hi John,

If you have "published" and InfoPath solution (XSN) to Sharepoint and you
want to find out the Sharepoint library/XSN that a form in that library is
bound to, you can use the following code:

XDocument.Solution.URI

As an example, if I published a form to: http://server/site/myFolder
executing the above line of code would return:

http://server/site/myFolder/Forms/template.xsn

Obviously, if you did not need the information all the way to the XSN you
could parse the returned path to get what you want.

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John Sivilla

thanks for the response. But with the limited string functions from xpath and
xslt, how would the parse code look like?

thanks,
 
S

Scott L. Heim [MSFT]

Hi John,

I was referring to using "script" (i.e. JScript) to get what you need. For
instance, using the same URL sample for publishing your InfoPath template:

http://server/site/myFolder

Executing this script:

var strURI = XDocument.Solution.URI;
var strFormLib = strURI.substr(0, strURI.indexOf("template.xsn"));

Returns:

http://server/site/myFolder/Forms/

Whereas modifying the script to:

var strURI = XDocument.Solution.URI;
var strFormLib = strURI.substr(0, strURI.indexOf("Forms/template.xsn"));

Returns:

http://server/site/myFolder/

Does this help you?

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Scott L. Heim [MSFT]

Thanks for letting me know John!

Take care,

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Paul B

Do you have a way of doing this in IF 2007. I need the address of the site
the form is loaded not the location of the form template.

Thanks in advance

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top