<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Get name of form library from form</title><link>https://www.infopathdev.com:443/forums/thread/68774.aspx</link><pubDate>Wed, 27 Jul 2011 17:19:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68774</guid><dc:creator>enthdegree_</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68774.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=68774</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;At any rate, Here&amp;#39;s what I&amp;#39;m doing right now. I get the browser form&amp;#39;s URI and then pull the library name out of that.&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;For the sake of organization, paste this snippet right underneath the comment block that talks about member variables: &lt;/p&gt;
&lt;code&gt;&amp;nbsp; private object _strUri&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return FormState[&amp;quot;_strUri&amp;quot;]; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { FormState[&amp;quot;_strUri&amp;quot;] = value; }&lt;br /&gt;&amp;nbsp; }&lt;/code&gt;

&lt;p&gt;In my form load event code ( Tools &amp;gt; Programming &amp;gt; Loading Event... ):&lt;/p&gt;
&lt;code&gt; _strUri = e.InputParameters[&amp;quot;SaveLocation&amp;quot;].ToString(); &lt;/code&gt;

&lt;p&gt;In my submit code: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;
&lt;code&gt;&amp;nbsp; // Get URI&lt;br /&gt;&amp;nbsp; string sUri = _strUri.ToString();&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp; // Extract library name&lt;br /&gt;
&amp;nbsp; int nUriLastSlashIndex = sUri.LastIndexOf(&amp;#39;/&amp;#39;);&lt;br /&gt;&amp;nbsp; int nUriSecondToLastSlashIndex = sUri.LastIndexOf(&amp;#39;/&amp;#39;, nUriLastSlashIndex - 1);&lt;br /&gt;&amp;nbsp; int nLibraryStringStartPosition = nUriSecondToLastSlashIndex + 1;&lt;br /&gt;&amp;nbsp; int nLibraryStringLength = nUriLastSlashIndex - nUriSecondToLastSlashIndex - 1;&lt;br /&gt;&amp;nbsp; string sLibrary = sUri.Substring(nLibraryStringStartPosition, nLibraryStringLength);&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp; // Write the value to somewhere in the form&lt;br /&gt;&amp;nbsp; XPathNavigator xpnThis = this.MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp; xpnThis.SelectSingleNode(&amp;quot;/my:myFields/my:FormSuppliments/my:FormLibraryName&amp;quot;, this.NamespaceManager).SetValue(sLibrary);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;EDIT: Ok, I&amp;#39;ve looked it up and this little code snippet isn&amp;#39;t technically &amp;#39;supposed&amp;#39; to work unless you close the form and reopen it exactly as I said I /didn&amp;#39;t/ want to do. I have no idea how I had it working. Anyway it did jus break for me but fortunately I found a fix so I&amp;#39;ve edited it in.&lt;/p&gt;</description></item><item><title>Get name of form library from form</title><link>https://www.infopathdev.com:443/forums/thread/68773.aspx</link><pubDate>Wed, 27 Jul 2011 16:06:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:68773</guid><dc:creator>enthdegree_</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/68773.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=68773</wfw:commentRss><description>&lt;p&gt;Hello all,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have an InfoPath 2007 form up on a SharePoint 2007 form library. Is it possible for the form to get the name of it&amp;#39;s library?&lt;/p&gt;&lt;p&gt;&amp;nbsp;This has left me stumped for quite a while. Initially I thought it was floating somewhere in the data connections wizard but I couldn&amp;#39;t find it there. I&amp;#39;ve been doing it in part of my form code with uri parsing but it seems like that solution has the potential to break very easily. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thank you! &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>