<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Programatically copy Sharepoint list into Main data source - not copying data</title><link>https://www.infopathdev.com:443/forums/thread/56336.aspx</link><pubDate>Wed, 30 Jun 2010 11:08:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:56336</guid><dc:creator>bijayani</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/56336.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=56336</wfw:commentRss><description>To copy SharePoint lists from one site to another site. It can be done in code as long as the two sites are on the same machine. It&amp;#39;s fine if they are in different web applications, but it can&amp;#39;t be from one server to another. If you need to copy from one server to another, you either need to do an export/import, or find a way to save the settings and import them on the new machine. You can use the SharePoint Web Services to accomplish this, though.

Here&amp;#39;s the code:



// Instantiate web instances


SPSite sourceSite = new SPSite(@http://sharepointserver:31001/);

SPWeb sourceWeb = sourceSite.RootWeb;

SPSite destSite = SPContext.Current.Site;
SPWeb destWeb = destSite.RootWeb;


// Get a reference to the source list


SPList sourceList = sourceWeb.GetList(&amp;quot;/Lists/Announcements&amp;quot;);


// if the list exists on the destination site, delete it

try

{


SPList temp = destWeb.Lists[sourceList.Title];
destWeb.Lists.Delete(temp.ID);

}

Read this blog for more information: http://subashandsharepoint.blogspot.com/2010/02/copy-sharepoint-list-programmatically.html

Hope you find it useful.</description></item><item><title>Re: Programatically copy Sharepoint list into Main data source - not copying data</title><link>https://www.infopathdev.com:443/forums/thread/53736.aspx</link><pubDate>Thu, 15 Apr 2010 17:11:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53736</guid><dc:creator>vriyer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53736.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=53736</wfw:commentRss><description>&lt;p&gt;I did add displays on the code - as you can see.. Here is some more update.. In the initial definition of the list, I have the code as - &lt;/p&gt;
&lt;p&gt;&amp;nbsp;var extlist = XDocument.GetDOM(&amp;quot;Phase_Metrics&amp;quot;).selectNodes(&amp;quot;/myFields/dataFields/PhaseMetrics&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;in the path in the selectNodes, the xpath for the list has a dfs: prefix - /dfs:myFields/dfs:dataFields/dfs:PhaseMetrics. With this definition, it shows an error..&lt;/p&gt;</description></item><item><title>Re: Programatically copy Sharepoint list into Main data source - not copying data</title><link>https://www.infopathdev.com:443/forums/thread/53726.aspx</link><pubDate>Thu, 15 Apr 2010 13:51:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53726</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53726.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=53726</wfw:commentRss><description>&lt;p&gt;why dont you debug your template and find out what is going wrong, to debug&lt;/p&gt;
&lt;p&gt;save a copy of your submitted form on your machine,&lt;/p&gt;
&lt;p&gt;open the form template in design mode&lt;/p&gt;
&lt;p&gt;in the form -&amp;gt; preview -&amp;gt; preview settings -&amp;gt; form name give specify the saved form.&lt;/p&gt;
&lt;p&gt;open the code of the form and put debug points in the submit code and press f5. and try submitting the form.&lt;/p&gt;</description></item><item><title>Programatically copy Sharepoint list into Main data source - not copying data</title><link>https://www.infopathdev.com:443/forums/thread/53699.aspx</link><pubDate>Wed, 14 Apr 2010 21:11:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:53699</guid><dc:creator>vriyer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/53699.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=53699</wfw:commentRss><description>&lt;p&gt;I am trying to copy a sharepoint list data into Main data source... Here is the script I have - the problem is it is not going inside the While loop for the insertion process.. Any help is appreciated&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;function&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CTRL79_5::OnClick(eventObj)&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Begin Code&amp;quot;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; extlist =XDocument.GetDOM(&amp;quot;PhaseMetrics&amp;quot;).selectNodes(&amp;quot;/Phase_Metrics&amp;quot;);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;XDocument.UI.Alert(&amp;quot;After the first list&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// If nothing was found, then return; there will be no items to insert. &lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(extlist == &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Nothing was returned&amp;quot;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Before the Insertion point&amp;quot;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Get the Metrics insertion point.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; metricList = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:Financial/my:Fin_Phase_Metrics&amp;quot;);&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;After the Insertion point&amp;quot;);&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Add the rows to the main DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; metric;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Before the Loop&amp;quot;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;while&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(metric = extlist.nextNode())&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;try&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Get this Phase Metrics values from the secondary DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Inside the loop&amp;quot;);&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; bcws = metric.selectSingleNode(&amp;quot;@BCWS&amp;quot;).text;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; bcwp = metric.selectSingleNode(&amp;quot;@BCWP&amp;quot;).text;&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; acwp = metric.selectSingleNode(&amp;quot;@ACWP&amp;quot;).text;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; name = metric.selectSingleNode(&amp;quot;@Name&amp;quot;).text;&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; start = metric.selectSingleNode(&amp;quot;@Start&amp;quot;).text;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; finish = metric.selectSingleNode(&amp;quot;@Finish&amp;quot;).text;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Build a string representing a main DOM nodeset using the values from the secondary DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; metricXml = &amp;quot;&amp;lt;my:Fin_Phase_Metrics xmlns:my=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-03T00:09:57&amp;#39;&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_BCWS&amp;gt;&amp;quot; + bcws + &amp;quot;&amp;lt;/my:Fin_Phase_BCWS&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_BCWP&amp;gt;&amp;quot; + bcwp + &amp;quot;&amp;lt;/my:Fin_Phase_BCWP&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_ACWP&amp;gt;&amp;quot; + acwp + &amp;quot;&amp;lt;/my:Fin_Phase_ACWP&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_Name&amp;gt;&amp;quot; + name + &amp;quot;&amp;lt;/my:Fin_Phase_Name&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_Start&amp;gt;&amp;quot; + start + &amp;quot;&amp;lt;/my:Fin_Phase_Start&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;+ &amp;quot;&amp;lt;my:Fin_Phase_Finish&amp;gt;&amp;quot; + finish + &amp;quot;&amp;lt;/my:Fin_Phase_Finish&amp;gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;After the XML Line&amp;quot;);&lt;/p&gt;
&lt;p&gt;metricXml += &amp;quot;&amp;lt;/my:Fin_Phase_Metrics&amp;gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Load string into a temporary XML DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; domNewRow = XDocument.CreateDOM();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;domNewRow.validateOnParse = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/p&gt;domNewRow.async = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;false&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;domNewRow.loadXML(metricXml);&lt;/p&gt;
&lt;p&gt;domNewRow.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;#39;xmlns:my=&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-06-03T00:09:57&amp;quot;&amp;#39;);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;// Insert into the main DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;metricList.appendChild(domNewRow.selectSingleNode(&amp;quot;my:Fin_Phase_Metrics&amp;quot;));&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;catch&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;(ex)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;Could not insert Phase Metric row.\n\nError message:\n&amp;quot; + ex.Message);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;XDocument.UI.Alert(&amp;quot;After the loop&amp;quot;);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;Based on the displays, I am going till the While loop and not inside it... &lt;/font&gt;&lt;/p&gt;</description></item></channel></rss>