How to get InfoPath Form name in SP library?

L

lior

I have an InfoPath form which in it's code I operate searching (by field
parametr) in SharePoint Forms Library (contain others InfoPath form- xml) .

I want to be able to open the form that was found; I must to get the fotm
name. I use this code:

//////////////////

var dataObj= XDocument.DataObjects("StudentsForms");

var dataDom=dataObj.DOM;

dataDom.setProperty
("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ');

dataObj.Query();

var selectedNode =
dataDom.selectSingleNode("/dfs:myFields/dfs:dataFields/dsf:Students
[@IDnumber='" + strId + "']");

var fname=selectedNode.attributes.getNamedItem("FirstName").text;

////////////////

As you can see, In the last row I get the "FirstName" value which is column
in the SharePoint Forms Library,

How can i get the name of the InfoPath form file (Which is also culomn in
the list) ?????
 
K

K.Ramana Reddy(GGK Tech)

Hi,

How are you saving your form name?
Are you using any field from the form as file name?
 
L

lior

Yes....O.K

I know what's your idea, I try it and its work. Is any option to get the
library URL?? (I dont want to write it hard coded)

K.Ramana Reddy(GGK Tech) said:
Hi,

How are you saving your form name?
Are you using any field from the form as file name?
--
k.Ramana Reddy
http://www.GGKtech.com


lior said:
I have an InfoPath form which in it's code I operate searching (by field
parametr) in SharePoint Forms Library (contain others InfoPath form- xml) .

I want to be able to open the form that was found; I must to get the fotm
name. I use this code:

//////////////////

var dataObj= XDocument.DataObjects("StudentsForms");

var dataDom=dataObj.DOM;

dataDom.setProperty
("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ');

dataObj.Query();

var selectedNode =
dataDom.selectSingleNode("/dfs:myFields/dfs:dataFields/dsf:Students
[@IDnumber='" + strId + "']");

var fname=selectedNode.attributes.getNamedItem("FirstName").text;

////////////////

As you can see, In the last row I get the "FirstName" value which is column
in the SharePoint Forms Library,

How can i get the name of the InfoPath form file (Which is also culomn in
the list) ?????
 
K

K.Ramana Reddy(GGK Tech)

Hi,
use below code to get the sharepoint form library url.

string sUri = thisXDocument.Solution.URI;(this will return "
http://servername/libarryname/forms/template.xsn")
int iPosition = sUri.LastIndexOf("/Forms/");( getting the forms index)

return -1 != iPosition ? sUri.Substring(0, iPosition + 1) : "";( getting the
URL upto fomr libary)

I hope this will help for you.
--
k.Ramana Reddy
http://www.GGKtech.com


lior said:
Yes....O.K

I know what's your idea, I try it and its work. Is any option to get the
library URL?? (I dont want to write it hard coded)

K.Ramana Reddy(GGK Tech) said:
Hi,

How are you saving your form name?
Are you using any field from the form as file name?
--
k.Ramana Reddy
http://www.GGKtech.com


lior said:
I have an InfoPath form which in it's code I operate searching (by field
parametr) in SharePoint Forms Library (contain others InfoPath form- xml) .

I want to be able to open the form that was found; I must to get the fotm
name. I use this code:

//////////////////

var dataObj= XDocument.DataObjects("StudentsForms");

var dataDom=dataObj.DOM;

dataDom.setProperty
("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ');

dataObj.Query();

var selectedNode =
dataDom.selectSingleNode("/dfs:myFields/dfs:dataFields/dsf:Students
[@IDnumber='" + strId + "']");

var fname=selectedNode.attributes.getNamedItem("FirstName").text;

////////////////

As you can see, In the last row I get the "FirstName" value which is column
in the SharePoint Forms Library,

How can i get the name of the InfoPath form file (Which is also culomn in
the list) ?????
 

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