<?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: Pulling a single value, either from db or SP List</title><link>https://www.infopathdev.com:443/forums/thread/3504.aspx</link><pubDate>Tue, 21 Nov 2006 18:25:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3504</guid><dc:creator>tkflick</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3504.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3504</wfw:commentRss><description>Thanks for the reply Patrick. &lt;br /&gt;&lt;br /&gt;I've found a couple of examples that might work, but they are in J Script and I'm having trouble converting to C#. I think I'm pretty close here, but can't seem to get the last little bit. Directly below is the edited version of the example I found on InfopathDev.com. Below that is the unedited version of what I found. &lt;br /&gt;&lt;br /&gt;If I'm on the right path and can get the loop working (big If's, I know), I think I'm golden. &lt;br /&gt;&lt;br /&gt;Any insight on getting that while loop to loop thru the items in the List?&lt;br /&gt;&lt;br /&gt;// NEED THIS DECLARATION IN C#&lt;br /&gt;// I THINK IT WOULD BE:&lt;br /&gt;// IXMLDOMDocument3 oSharePointDom = (IXMLDOMDocument3)thisXDocument.DataObjects["AccessLevelList"].DOM;&lt;br /&gt;var oSharePointDom = XDocument.GetDOM( "AccessLevelList" );&lt;br /&gt;&lt;br /&gt;// THIS APPEARS TO WORK AS IS... AT LEAST I GET NO COMPILE ERRORS AT THIS POINT&lt;br /&gt;oSharePointDom.setProperty("SelectionNamespaces","xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution'");&lt;br /&gt;&lt;br /&gt;// I DON'T NEED THE LOCAL DOM SINCE I'M NOT RESETTING ANY ITEMS ON MY FORM, JUST LOOKING FOR THE ACCESS LEVEL.. SO I'VE REMOVED THIS PART&lt;br /&gt;&lt;br /&gt;// I THINK THIS DECLARATION SHOULD BE: &lt;br /&gt;// IXMLDOMNode nLSharedItems = oSharePointDom.selectNodes("/dfs:user_id/dfs:access_level");&lt;br /&gt;var nlSharedItems = oSharePointDom.selectNodes( "/dfs:user_name/dfs:access_level" );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// WITHOUT THE LOCAL DOM TO COMPARE AGAINST, I'M NOT SURE OF THE SYNTAX FOR THE COMPARISON IN THE LOOP &lt;br /&gt;// I DON'T HAVE THE "nSharedItem" FOR THE LOOP COMPARISON AND THERE IS NO "NEXTNODE" AVAILABLE IN C#&lt;br /&gt;while( (nlSharedItems.nextNode() ) != null )&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;	// ONCE INSIDE THE LOOP, I WILL RUN THE COMPARISON AGAINST THE USER_NAME&lt;br /&gt;	if(sUserName == nlSharedItem.selectSingleNode("@user_name").text)&lt;br /&gt;	{&lt;br /&gt;		sUserAccess = nlSharedItem.selectSingleNode("@access_level");&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;THIS IS THE CODE I CHANGED TO TRY AND MAKE IT WORK FOR ME IN C#:&lt;br /&gt;&lt;br /&gt;    // Get the updated version of the List&lt;br /&gt;    // If the user is offline, the code will skip to the "catch" block below&lt;br /&gt;    XDocument.DataObjects["Products Online"].Query();&lt;br /&gt; &lt;br /&gt;    // Get the ShareList DOM&lt;br /&gt;    var oSharePointDom = XDocument.GetDOM( "Products Online" );&lt;br /&gt;    // Setup the Namespaces&lt;br /&gt;    oSharePointDom.setProperty("SelectionNamespaces",&lt;br /&gt;        'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' );&lt;br /&gt; &lt;br /&gt;    // Get the local DOM - to does not use namespaces&lt;br /&gt;    var oLocalDom = XDocument.GetDOM( "Products Offline" );&lt;br /&gt; &lt;br /&gt;    // Get a sample cached list node that we will need to clone later&lt;br /&gt;    var nSampleProductNode = oLocalDom.selectSingleNode( "/CachedList/Products/Product" );&lt;br /&gt; &lt;br /&gt;    // Remove all of the items from the local copy of the list&lt;br /&gt;    oLocalDom.selectNodes( "/CachedList/Products/Product" ).removeAll();&lt;br /&gt; &lt;br /&gt;    // Loop through all of the items in the SharePoint List&lt;br /&gt;    var nlSharedItems = oSharePointDom.selectNodes( "/dfs:myFields/dfs:dataFields/dfs:Products" );&lt;br /&gt; &lt;br /&gt;    while( (nSharedItem = nlSharedItems.nextNode() ) != null )&lt;br /&gt;    {&lt;br /&gt;        // Create a new row from the sample&lt;br /&gt;        var nNewLocalCacheRow = nSampleProductNode.cloneNode(true);&lt;br /&gt; &lt;br /&gt;        // Set the values&lt;br /&gt;        nNewLocalCacheRow.selectSingleNode( "@ID" ).text = nSharedItem.selectSingleNode( "@ID" ).text;&lt;br /&gt;        nNewLocalCacheRow.selectSingleNode( "@Name" ).text = nSharedItem.selectSingleNode( "@Name" ).text;&lt;br /&gt;        nNewLocalCacheRow.selectSingleNode( "@Description" ).text = nSharedItem.selectSingleNode( "@Description" ).text;&lt;br /&gt; &lt;br /&gt;        // Append to to our local cached list&lt;br /&gt;        oLocalDom.selectSingleNode( "/CachedList/Products" ).appendChild( nNewLocalCacheRow );&lt;br /&gt;    }</description></item><item><title>Re: Pulling a single value, either from db or SP List</title><link>https://www.infopathdev.com:443/forums/thread/3503.aspx</link><pubDate>Tue, 21 Nov 2006 06:39:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:3503</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/3503.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=3503</wfw:commentRss><description>Hi Tim,&lt;br /&gt;There are a couple HowTos written that explain how to get/set data from SharePoint lists. Also, Chapter 9 in my book describes this. Go th the "Search InfoPathDev for:" text field and enter "SharePoint list my filter". Let me know if you don't find it.&lt;br /&gt;Regards,</description></item><item><title>Pulling a single value, either from db or SP List</title><link>https://www.infopathdev.com:443/forums/thread/1671.aspx</link><pubDate>Thu, 16 Nov 2006 20:07:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:1671</guid><dc:creator>tkflick</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/1671.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=1671</wfw:commentRss><description>I have 4 types of users. Each type of user will see a slightly different version of my form. In the OnLoad event, I can get the user_name from the System.Environment.UserName command. I then want to use that user name to query a Sharepoint list that contains the access_level associated with that user_name.  I would then use the access_level to decide which View to load.&lt;br /&gt;&lt;br /&gt;How do I return just the access_level associated with the user_name, and then grab the returned value so that I can use it to decide which view to display?&lt;br /&gt;&lt;br /&gt;If anyone can point me in the right direction, I would be most greatful.&lt;br /&gt;&lt;br /&gt;Thanks very much,&lt;br /&gt;Tim</description></item></channel></rss>