<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Programming</title>
        <link>http://www.lancerobinson.net/category/1855.aspx</link>
        <description>Programming</description>
        <language>en-US</language>
        <copyright>Lance Robinson</copyright>
        <managingEditor>lmrobins@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>ADO.NET Entity Framework &amp;ndash; Code First Development Pattern</title>
            <link>http://lancerobinson.net/archive/2011/04/14/ado.net-entity-framework-ndash-code-first-development-pattern.aspx</link>
            <description>&lt;p&gt;Here’s a quick start introduction to the ADO.NET Entity Framework Code First Development Pattern.  For a more complete (but still intro) walkthrough, check out &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx"&gt;ScottGu’s blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;At the time of this writing, you’ll need the &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2dc5ddac-5a96-48b2-878d-b9f49d87569a&amp;amp;displaylang=en"&gt;EF 4.1 Release Candidate&lt;/a&gt;.  After EF 4.1 is released you’ll no doubt be able to find it on the &lt;a href="http://blogs.msdn.com/b/adonet/"&gt;ADO.NET team blog&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;1.  &lt;strong&gt;Create a new empty ASP.NET MVC2 Web Application&lt;/strong&gt;, add a reference to System.Data.Entity.  If using the EF4.1 RC - add a reference to the EntityFramework dll that comes installed with it.&lt;/p&gt;  &lt;p&gt;2.  &lt;strong&gt;Add the model classes&lt;/strong&gt; you’d like to represent your data objects.  For example if you need to represent game nights, you might create a class called Game with properties that describe the game night date, location, and other information.&lt;/p&gt;  &lt;p&gt;3.  &lt;strong&gt;Create a “Context Class”&lt;/strong&gt; that inherits &lt;strong&gt;DbContext&lt;/strong&gt;, which contains nothing but &lt;strong&gt;DbSet&lt;/strong&gt;&amp;lt;yourclassnamefromstep2&amp;gt; public properties.  For example if you created in step 2 a class called “Game”, here you’d have a property defined as:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;public DbSet&amp;lt;Game&amp;gt; Games { get; set; }&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;At this point, EF code first will make &lt;a href="http://blogs.msdn.com/b/efdesign/archive/2010/06/01/conventions-for-code-first.aspx"&gt;certain assumptions&lt;/a&gt; (which we can &lt;a href="http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-code-first.aspx"&gt;override&lt;/a&gt; later if necessary) that allow us to write less code:&lt;/p&gt;  &lt;p&gt;- The context class will map its properties (those DbSet properties) to tables with the same names (a Games table, in our example).&lt;/p&gt;  &lt;p&gt;- Each row in that table will map to an instance of the model class (a Game instance, in our example).  &lt;/p&gt;  &lt;p&gt;- Properties in the model class are columns in the table.&lt;/p&gt;  &lt;p&gt;- A property in the model class with the name “Id” or “&amp;lt;classname&amp;gt;Id” will be made the primary key.&lt;/p&gt;  &lt;p&gt;- Relationships between tables are inferred if one model class has a property with the name “&amp;lt;otherclassname&amp;gt;Id”.&lt;/p&gt;  &lt;p&gt;4.  &lt;strong&gt;Add a controller&lt;/strong&gt; to see EF Code First in action.  For example, add Index (to just return a list of our game nights) and Create actions (to create a new game night).&lt;/p&gt;  &lt;p&gt;5.  &lt;strong&gt;Add the views&lt;/strong&gt; (Index: strongly typed IEnumerable of Game, Create: strongly typed Game – content Create).&lt;/p&gt;  &lt;p&gt;6.  &lt;strong&gt;Create the database&lt;/strong&gt;.  One of those EF Code First assumptions is that it will automatically look for a connection string with the same name as the context class (eg, Games).  Scott Guthrie recommends the use of SQL CE 4 for early development, and moving to SQL Server or SQL Express closer to the time of deployment.&lt;/p&gt;  &lt;p&gt;Important:  IF you’re using SQL CE or SQL Express, and your connection string points to a database file that does not yet exist, it will be automatically created for you!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Updating The Model&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If you update the model (lets say we add a new property to our Game class), you’ll get an error the next time you attempt to run the application (“context has changed since the database was created”.  EF Code First can handle this too:  in Global.asax, add the following to the Application_Start event handler:&lt;/p&gt;  &lt;p&gt;Database.SetInitializer&amp;lt;&amp;lt;yourContextClass&amp;gt;&amp;gt;(new RecreateDatabaseIfModelChanges&amp;lt;&amp;lt;yourContextClass&amp;gt;&amp;gt;());   &lt;br /&gt;RegisterRoutes(RouteTable.Routes);&lt;/p&gt;  &lt;p&gt;Gu gives a nice tip – create a custom class that implements RecreateDatabaseIfMOdelChanges&amp;lt;&amp;lt;yourContextClass)&amp;gt; and overrides the Seed function to add “seed” rows to the database with default data.  This way when we recreate the database after a model update, the database isn’t empty – but is seeded with our default data.  Use this new custom class in the call to SetInitializer instead of RecreateDatabaseIfModelChanges.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9a6bb00a-267d-4dc1-a98e-a6be74e12181" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/ASPNET" rel="tag"&gt;ASPNET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MVC" rel="tag"&gt;MVC&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Entity+Framework" rel="tag"&gt;Entity Framework&lt;/a&gt;,&lt;a href="http://technorati.com/tags/EF" rel="tag"&gt;EF&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Code+First" rel="tag"&gt;Code First&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/144881.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2011/04/14/ado.net-entity-framework-ndash-code-first-development-pattern.aspx</guid>
            <pubDate>Thu, 14 Apr 2011 07:42:00 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/144881.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2011/04/14/ado.net-entity-framework-ndash-code-first-development-pattern.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/144881.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/144881.aspx</trackback:ping>
        </item>
        <item>
            <title>Visual Studio 2010 Find and Replace With Regular Expressions</title>
            <link>http://lancerobinson.net/archive/2011/03/10/visual-studio-2010-find-and-replace-with-regular-expressions.aspx</link>
            <description>&lt;p&gt;Here is a quick notes about using regular expressions in the VS2010 Find Replace dialog.  &lt;/p&gt;  &lt;p&gt;1.  To create a backreference, use curly braces (“{“ and “}” ) instead of regular parentheses.&lt;/p&gt;  &lt;p&gt;2.  To use the captured backreference, use \1\2 etc, where \1 is the first captured value, \2 is the second captured value, etc.&lt;/p&gt;  &lt;p&gt;Example:&lt;/p&gt;  &lt;p&gt;I want to find*:&lt;/p&gt;  &lt;p&gt;info.setFieldValue(param1, param2);&lt;/p&gt;  &lt;p&gt;and replace it with:&lt;/p&gt;  &lt;p&gt;SetFieldValue(info, param1, param2);&lt;/p&gt;  &lt;p&gt;To do this, I can use the following find/replace values:&lt;/p&gt;  &lt;p&gt;Find what:&lt;/p&gt;  &lt;p&gt;{[a-zA-Z0-9]+}.setFieldValue\({[a-zA-Z0-9., ]+}\);&lt;/p&gt;  &lt;p&gt;Replace with:&lt;/p&gt;  &lt;p&gt;SetFieldValue(\1, \2);&lt;/p&gt;  &lt;p&gt;Use Regular Expressions is checked, of course.&lt;/p&gt;  &lt;p&gt;*If you’re wondering why I’d want to do this – because I don’t have control over the setFieldValue function – its in a third party library that doesn’t behave in a very friendly manner.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:ecb9f52c-12f2-4402-9640-8f9242ab53ae" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Visual+Studio" rel="tag"&gt;Visual Studio&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Regular+Expressions" rel="tag"&gt;Regular Expressions&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/144301.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2011/03/10/visual-studio-2010-find-and-replace-with-regular-expressions.aspx</guid>
            <pubDate>Thu, 10 Mar 2011 22:07:24 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/144301.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2011/03/10/visual-studio-2010-find-and-replace-with-regular-expressions.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/144301.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/144301.aspx</trackback:ping>
        </item>
        <item>
            <title>Creating Team Foundation Work Items With PowerShell</title>
            <link>http://lancerobinson.net/archive/2011/01/26/creating-team-foundation-work-items-with-powershell.aspx</link>
            <description>&lt;p&gt;Here is the simple function I added to my powershell profile:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="width: 80%; margin-left: auto; margin-right: auto"&gt;
&lt;div class="psheader-left"&gt; &lt;/div&gt;
&lt;div class="psheader-right"&gt; &lt;/div&gt;
&lt;div class="psheader-middle"&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div class="psbody-left"&gt; &lt;/div&gt;
&lt;div class="psbody-right"&gt; &lt;/div&gt;
&lt;div class="psbody-middle"&gt;
&lt;div class="psscriptscrollarea"&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre&gt;
function create-tfstask ($desc) {
 tfpt workitem /new $workItemType /collection:$serverUrl /fields:"Title=$($desc);Assigned To=$assignee;AreaId=$areaId;IterationId=$iterationId"
}&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="width: 100%"&gt;
&lt;div class="psfooter-left"&gt; &lt;/div&gt;
&lt;div class="psfooter-right"&gt; &lt;/div&gt;
&lt;div class="psfooter-middle"&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To find the AreaId and IterationId for your project/versions, just look at a bug you know is setup correctly:&lt;/p&gt;
&lt;p&gt;PS C:\&amp;gt; tfpt query /collection:&lt;a href="http://3bs001vsteam:8080/tfs"&gt;http://3bs001vsteam:8080/tfs&lt;/a&gt; /wiql:"select AreaId,IterationId from workitems where ID = 879"&lt;/p&gt;
&lt;p&gt;Next I hooked this into &lt;a href="http://lancerobinson.net/archive/2010/10/26/quick-powershell-ldquotodordquo-gmail-emailer.aspx"&gt;my existing "todo" function&lt;/a&gt; by adding a new case in its $target switch statement for “tfs”, which calls my create-tfstask function and returns.  Updated todo function:&lt;/p&gt;
&lt;div style="width: 80%; margin-left: auto; margin-right: auto"&gt;
&lt;div class="psheader-left"&gt; &lt;/div&gt;
&lt;div class="psheader-right"&gt; &lt;/div&gt;
&lt;div class="psheader-middle"&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div class="psbody-left"&gt; &lt;/div&gt;
&lt;div class="psbody-right"&gt; &lt;/div&gt;
&lt;div class="psbody-middle"&gt;
&lt;div class="psscriptscrollarea"&gt;
&lt;pre&gt;
function todo {
  param([string] $target = "work",
        [string] $msg )
			
  $emailFrom = "lance@3birdsmarketing.com"
	
  #combine all the cmd line args into one "message"
  if ($args -ne "") {
    $msg = $msg + " " + $args
  }
	
  #what is the target of the message?
  switch ($target)
  {
    "work" { $target = "lance@3birdsmarketing.com" }
    "home" { $target = "lmrobins@gmail.com" }
    "tfs" { create-tfstask $msg; return }
  }	
	
  $subject = "Todo: " + $msg
  $body = $msg
  $smtpServer = "3bs001exch"	
  $smtp = new-object Net.Mail.SmtpClient($smtpServer, 25)
  $smtp.Send($emailFrom, $target, $subject, $body)
}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="width: 100%"&gt;
&lt;div class="psfooter-left"&gt; &lt;/div&gt;
&lt;div class="psfooter-right"&gt; &lt;/div&gt;
&lt;div class="psfooter-middle"&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8cb4d90c-7189-41e7-b9ab-c330c875c6d7" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/PowerShell"&gt;PowerShell&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/TFS"&gt;TFS&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Team+Foundation"&gt;Team Foundation&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/143640.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2011/01/26/creating-team-foundation-work-items-with-powershell.aspx</guid>
            <pubDate>Wed, 26 Jan 2011 15:58:22 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/143640.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2011/01/26/creating-team-foundation-work-items-with-powershell.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/143640.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/143640.aspx</trackback:ping>
        </item>
        <item>
            <title>How do I rollback a TFS check-in?</title>
            <link>http://lancerobinson.net/archive/2010/12/21/how-do-i-rollback-a-tfs-check-in.aspx</link>
            <description>&lt;p&gt;I can never remember how to rollback a check-in, and there all kinds of mess in search results about this (change between different versions of TFS etc), so I thought I’d just put this here so I won’t forget anymore.  :)  Thanks to @manningj, TFS genius.&lt;/p&gt;
&lt;p&gt;Just drop to the command line and use tf.exe.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;tf rollback /changeset:12345&lt;/p&gt;
&lt;p&gt;For more on the tf.exe commands:&lt;/p&gt;
&lt;p&gt;tf help&lt;/p&gt;
&lt;p&gt;&lt;a rel="lightbox" href="http://geekswithblogs.net/images/geekswithblogs_net/Lance/WindowsLiveWriter/HowdoIrollbackaTFScheckin_A04D/image_2.png"&gt;&lt;img title="image" border="0" alt="image" width="626" height="316" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" src="http://geekswithblogs.net/images/geekswithblogs_net/Lance/WindowsLiveWriter/HowdoIrollbackaTFScheckin_A04D/image_thumb.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1bc7f2f7-8865-4585-819e-f511d78cfff6" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/Visual+Studio"&gt;Visual Studio&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Team+Foundation"&gt;Team Foundation&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/Rollback"&gt;Rollback&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/143196.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/12/21/how-do-i-rollback-a-tfs-check-in.aspx</guid>
            <pubDate>Tue, 21 Dec 2010 16:24:04 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/143196.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/12/21/how-do-i-rollback-a-tfs-check-in.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/143196.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/143196.aspx</trackback:ping>
        </item>
        <item>
            <title>PowerShell &amp;ndash; Recycle All IIS App Pools</title>
            <link>http://lancerobinson.net/archive/2010/12/16/powershell-ndash-recycle-all-iis-app-pools.aspx</link>
            <description>&lt;p&gt;With a little help from Shay Levy’s post on Stack Overflow and the MSDN documentation, I added this handy function to my profile to automatically recycle all IIS app pools.&lt;/p&gt;
&lt;div style="width: 80%; margin-left: auto; margin-right: auto;"&gt;
&lt;div class="psheader-left"&gt; &lt;/div&gt;
&lt;div class="psheader-right"&gt; &lt;/div&gt;
&lt;div class="psheader-middle"&gt; &lt;/div&gt;
&lt;div&gt;
&lt;div class="psbody-left"&gt; &lt;/div&gt;
&lt;div class="psbody-right"&gt; &lt;/div&gt;
&lt;div class="psbody-middle"&gt;
&lt;div class="psscriptscrollarea"&gt;
&lt;pre style="border: 1px solid rgb(206, 206, 206); padding: 5px; background-color: rgb(251, 251, 251); min-height: 40px; width: 650px; overflow: auto;"&gt;&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
function Recycle-AppPools {
  
    param(
    [string] $server = "3bhs001",
    [int] $mode = 1, # ManagedPipelineModes: 0 = integrated, 1 = classic
    ) &lt;p&gt; $iis = [adsi]"IIS://$server/W3SVC/AppPools"&lt;br /&gt; $iis.psbase.children | %{ &lt;br /&gt;   $pool = [adsi]($_.psbase.path); &lt;br /&gt;   if ($pool.AppPoolState -eq 2 -and $pool.ManagedPipelineMode -eq $mode) {&lt;br /&gt;     # AppPoolStates:  1 = starting, 2 = started, 3 = stopping, 4 = stopped          &lt;br /&gt;     $pool.psbase.invoke("recycle") &lt;br /&gt;     }&lt;br /&gt;   }&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;/pre&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="width: 100%;"&gt;
&lt;div class="psfooter-left"&gt; &lt;/div&gt;
&lt;div class="psfooter-right"&gt; &lt;/div&gt;
&lt;div class="psfooter-middle"&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://lancerobinson.net/aggbug/143156.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/12/16/powershell-ndash-recycle-all-iis-app-pools.aspx</guid>
            <pubDate>Thu, 16 Dec 2010 20:59:17 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/143156.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/12/16/powershell-ndash-recycle-all-iis-app-pools.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/143156.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/143156.aspx</trackback:ping>
        </item>
        <item>
            <title>Setting a Master Page Dynamically</title>
            <link>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx</link>
            <description>&lt;p&gt;To set an ASPNET master page dynamically, use the Page_PreInit function and set the Page.MasterPageFile property.  For example:&lt;/p&gt;  &lt;p&gt;protected void Page_PreInit(object sender, EventArgs e)    &lt;br /&gt;{     &lt;br /&gt;  this.Page.MasterPageFile = "~/MasterPages/" + mymaster + ".Master";     &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;In the above example, mymaster should be set by whatever your requirements dictate – read from DB/CMS/whatever.  The page (aspx) itself shouldn’t have any other reference to the master page (ie, no “MasterPageFile attribute in the page directive), however it will still need the content placeholders, of course.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:86992e1b-58c4-4e03-96ee-5e3bc518af92" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/ASPNET" rel="tag"&gt;ASPNET&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/141355.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx</guid>
            <pubDate>Tue, 17 Aug 2010 19:04:10 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141355.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/17/setting-a-master-page-dynamically.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141355.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141355.aspx</trackback:ping>
        </item>
        <item>
            <title>PowerShell TruncateAtWhitespace Function</title>
            <link>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx</link>
            <description>&lt;p&gt;Here’s a TruncateAtWhitespace function that takes an incoming parameter value and an incoming max length, and returns a substring broken at a whitespace position.  This way if you have “Lance has a blog” and you need to truncate it to 8 characters or less, you get “Lance” instead of “Lance ha”.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;function TruncateAtWhitespace{
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    param(
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;]$&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        [&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;]$maxlength=200
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    )
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $maxlength-=3; #allow &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;" suffix
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Length -le $maxlength) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; ($&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; + "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $closestwhitespaceindex = [&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;]$&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $maxlength).LastIndexOf("&lt;span style="color: #8b0000"&gt; &lt;/span&gt;");
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; ($closestwhitespaceindex -gt 0) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $closestwhitespaceindex) + "&lt;span style="color: #8b0000"&gt;...&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    } &lt;span style="color: #0000ff"&gt;else&lt;/span&gt; {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; = $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.Substring(0, $maxlength);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; $&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dee978aa-edc6-4e5a-a49a-64642738047e" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/141340.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx</guid>
            <pubDate>Mon, 16 Aug 2010 19:30:13 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141340.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/16/powershell-truncateatwhitespace-function.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141340.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141340.aspx</trackback:ping>
        </item>
        <item>
            <title>CSharp TruncateAtWhitespace Function</title>
            <link>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx</link>
            <description>&lt;p&gt;Here’s a TruncateAtWhitespace function that takes an incoming parameter value and an incoming max length, and returns a substring broken at a whitespace position.  This way if you have “Lance has a blog” and you need to truncate it to 8 characters or less, you get “Lance” instead of “Lance ha”.&lt;/p&gt;
&lt;pre style="border: 1px solid rgb(206, 206, 206); padding: 5px; background-color: rgb(251, 251, 251); min-height: 40px; width: 650px; overflow: auto;"&gt;&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// Truncate at the end of a word&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;param name="value"&amp;gt;The original string&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;param name="maxlength"&amp;gt;The maximum length of string to return&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(128, 128, 128);"&gt;/// &amp;lt;returns&amp;gt;A substring of the original, broken at the end of a word&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; TruncateAtWhitespace(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; maxlength)
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      maxlength = maxlength - 3; &lt;span style="color: rgb(0, 128, 0);"&gt;//allow for ending "..."&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (&lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Length &amp;lt;= maxlength) &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; + "&lt;span style="color: rgb(139, 0, 0);"&gt;...&lt;/span&gt;";
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; closestwhitespaceindex = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, maxlength).LastIndexOf("&lt;span style="color: rgb(139, 0, 0);"&gt; &lt;/span&gt;");
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (closestwhitespaceindex &amp;gt; 0)
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
        &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, closestwhitespaceindex) + "&lt;span style="color: rgb(139, 0, 0);"&gt;...&lt;/span&gt;";
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      }
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      {
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
        &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt; = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;.Substring(0, maxlength);
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      }
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
      &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;
&lt;/pre&gt;
&lt;pre style="background-color: rgb(251, 251, 251); margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px;"&gt;
    }&lt;/pre&gt;
&lt;/pre&gt;
&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:23317c5c-c7bb-4cad-84ea-b0e0e5bc4bd4" style="padding: 0px; margin: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/ASPNET"&gt;ASPNET&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/C%23"&gt;C#&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/141339.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx</guid>
            <pubDate>Mon, 16 Aug 2010 19:28:56 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/141339.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2010/08/16/csharp-truncateatwhitespace-function.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/141339.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/141339.aspx</trackback:ping>
        </item>
        <item>
            <title>Listing SPQuery FieldNameRefs</title>
            <link>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx</link>
            <description>&lt;p&gt;It took me a while to figure out how to get a list of all the available fields for a particular type of list in SharePoint (for performing custom queries in SPQuery).  I was looking for a published list of these fields, which as far as I know does not exist.  Instead, you just use the GetList method of the Lists SOAP service.  Here’s an example SOAP request:&lt;/p&gt;
&lt;div class="scrollarea"&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Envelope&lt;/span&gt; &lt;span class="attr"&gt;xmlns:SOAP-ENV&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.xmlsoap.org/soap/envelope/"&lt;/span&gt; &lt;span class="attr"&gt;SOAP-ENV:encodingStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.xmlsoap.org/soap/encoding/"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;GetList&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/sharepoint/soap/"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;listName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Private Documents&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;listName&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;GetList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; 
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;SOAP-ENV:Envelope&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Just specify the name of the list you want the fields for as the value for the listName input element.&lt;/p&gt;
&lt;p&gt;One easy way to work with SharePoint services remotely is by using /n software’s &lt;a href="http://www.nsoftware.com/ibiz/sharepoint/default.aspx"&gt;SharePoint Integrator&lt;/a&gt; developer toolkit.  Using its SPSite component in Visual Studio I can whip together a few lines of code to consume get the results from the aforementioned service:&lt;/p&gt;
&lt;div class="scrollarea"&gt;
&lt;pre class="csharpcode"&gt;
spsite1.URL = "http://mysharepoint/mysite/";
spsite1.User = "DOMAIN\lancer";  
spsite1.Password = "password";  
spsite1.DescribeList("Private SharePoint Documents");; &lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;/n software SharePoint Integrator highlights:&lt;/p&gt;
&lt;ul&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;em&gt;Read, Write, and Create SharePoint Lists Items, Documents, and Attachments. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Programmatic control of SharePoint Sites, capabilities, and configuration &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;128-bit strong SSL encryption keeps sensitive transaction information confidential. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Small and lightweight components with no dependencies on external libraries. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Native development components for all supported platforms and component technologies. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Unlimited free Email technical support backed by an experienced &amp;amp; professional staff. &lt;/em&gt;&lt;/li&gt;
        &lt;li&gt;&lt;em&gt;Compatible with Microsoft Office SharePoint Server (MOSS), and Windows SharePoint Services v3.0 + (WSS).&lt;/em&gt;&lt;/li&gt;
    &lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:18f83815-f83e-49e0-833c-875e863c33e2" class="wlWriterEditableSmartContent" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;Technorati Tags: &lt;a rel="tag" href="http://technorati.com/tags/SPQuery"&gt;SPQuery&lt;/a&gt;,&lt;a rel="tag" href="http://technorati.com/tags/SharePoint"&gt;SharePoint&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/136811.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx</guid>
            <pubDate>Mon, 07 Dec 2009 09:24:16 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/136811.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/12/07/listing-spquery-fieldnamerefs.aspx#feedback</comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/136811.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/136811.aspx</trackback:ping>
        </item>
        <item>
            <title>How to embed Excel in a .NET WinForms App</title>
            <link>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx</link>
            <description>&lt;ol&gt;   &lt;li&gt;&lt;a href="http://www.google.com/search?hl=en&amp;amp;q=Download+OWC11&amp;amp;aq=f&amp;amp;oq=&amp;amp;aqi="&gt;Download and install owc11&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Run AxImp on OWC11.dll, which will have been installed in the microsoft shared\web components directory (ie C:\Program Files\Common Files\microsoft shared\Web Components\11\).  AxImp.exe can be found in the Windows SDK (ie, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\AxImp.exe). &lt;/li&gt;    &lt;li&gt;In Visual Studio project, drag OWC11.dll to a toolbox tab and drop the Excel component on form. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Voila.  When it comes deployment time, you’ll need the AxInterop.OWC11.dll.&lt;/p&gt;  &lt;p&gt;Some sample code:&lt;/p&gt;  &lt;p&gt;Set a specific cell value:    &lt;br /&gt;Spreadsheet1.Cells.get_Item(row, col).set_Value(System.Reflection.Missing.Value, "BSXBW2183NN");&lt;/p&gt;  &lt;p&gt;Get the string value of a specific cell:    &lt;br /&gt;Spreadsheet1.Cells.get_Item(row, col).get_Value(System.Reflection.Missing.Value).ToString()     &lt;br /&gt;or     &lt;br /&gt;Spreadsheet1.Cells.get_Item(i, 1).Text.ToString();&lt;/p&gt;  &lt;p&gt;Set the background color of a row:    &lt;br /&gt;Object ob = "#66FF66";     &lt;br /&gt;Spreadsheet1.Rows.get_Item(row, System.Reflection.Missing.Value).Font.set_Color(ref ob);&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:c2bd0193-6f81-4a88-aaad-74d83262fe9b" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Excel" rel="tag"&gt;Excel&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET" rel="tag"&gt;.NET&lt;/a&gt;&lt;/div&gt; &lt;img src="http://lancerobinson.net/aggbug/134874.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Lance Robinson</dc:creator>
            <guid>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx</guid>
            <pubDate>Thu, 17 Sep 2009 13:19:35 GMT</pubDate>
            <wfw:comment>http://lancerobinson.net/comments/134874.aspx</wfw:comment>
            <comments>http://lancerobinson.net/archive/2009/09/17/how-to-embed-excel-in-a-.net-winforms-app.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://lancerobinson.net/comments/commentRss/134874.aspx</wfw:commentRss>
            <trackback:ping>http://lancerobinson.net/services/trackbacks/134874.aspx</trackback:ping>
        </item>
    </channel>
</rss>
