<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PowerPivotGeek &#187; Sample Code</title>
	<atom:link href="http://powerpivotgeek.com/category/sample-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://powerpivotgeek.com</link>
	<description>An adventure in managed self-service computing</description>
	<lastBuildDate>Wed, 19 Jan 2011 23:04:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using a SharePoint list as a data source</title>
		<link>http://powerpivotgeek.com/2010/10/28/using-a-sharepoint-list-as-a-data-source/</link>
		<comments>http://powerpivotgeek.com/2010/10/28/using-a-sharepoint-list-as-a-data-source/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 19:57:00 +0000</pubDate>
		<dc:creator>powerpivotgeek</dc:creator>
				<category><![CDATA[Data feeds]]></category>
		<category><![CDATA[Data refresh]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://powerpivotgeek.com/2010/07/12/using-a-sharepoint-list-as-a-data-source/</guid>
		<description><![CDATA[<p>Updated 28-Oct-2010: Some folks are reporting that an iisreset is needed to make the updates visible to SharePoint.</p>
<p>So . . . here I am playing around with PowerPivot to get ready for a demo. As this is a group from the SharePoint dev team (actually SharePoint Online), I wanted to include some cool SharePoint functionality [...]]]></description>
			<content:encoded><![CDATA[<p><strong><font style="background-color: #ffff00">Updated 28-Oct-2010:</font></strong> Some folks are reporting that an iisreset is needed to make the updates visible to SharePoint.</p>
<p>So . . . here I am playing around with PowerPivot to get ready for a demo. As this is a group from the SharePoint dev team (actually SharePoint Online), I wanted to include some cool SharePoint functionality into the demo. Trying to be cool and ‘wow’ them, I decide to use a SharePoint list as a data source. I want to show the data mashup capabilities of PowerPivot so I have the bulk of my demo come from the Contoso sample database (the three product catalog tables) and the 4 million row Sales Fact table.</p>
<p>I create my SP list by extracting the 11 distinct manufacturers – and I assign them to a ‘shipper’ that I made up.</p>
<p>  <span id="more-1161"></span> When I go to SharePoint an click on:
<p><a href="http://powerpivotgeek.com/wp-content/uploads/2010/07/capture.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="capture" border="0" alt="capture" src="http://powerpivotgeek.com/wp-content/uploads/2010/07/capture_thumb.jpg" width="640" height="484" /></a></p>
<p>PowerPivot comes up but it returns an error:</p>
<blockquote><p>&quot;For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method.&quot;</p>
</blockquote>
<p>So it turns out that I forgot (it happens to the best of us) to install the ADO.NET Data Services 3.5 SP1, located here: <a title="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=3e102d74-37bf-4c1e-9da6-5175644fe22d" href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=3e102d74-37bf-4c1e-9da6-5175644fe22d">http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=3e102d74-37bf-4c1e-9da6-5175644fe22d</a></p>
<p>Which I would have known if I had taken my own advice and read BOL beforehand. Read the “New server” installation notes here: <a title="http://msdn.microsoft.com/en-us/library/ee210708.aspx#nextsteps" href="http://msdn.microsoft.com/en-us/library/ee210708.aspx#nextsteps">http://msdn.microsoft.com/en-us/library/ee210708.aspx#nextsteps</a></p>
<p>So the moral of the story is: RTFM</p>
<p>After installing ADO.NET Data Services on my SharePoint site, I was able to bring up the data feed in PowerPivot – setup the relationship between the Manufacturer field in the SharePoint list and the Manufacturer field in the Contoso database and I was off and running . . . I also setup daily data refresh job . . . and I could see the Gallery snapshot changing as I entered new data into the SharePoint list . . WOW!</p>
<p>Enjoy!</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fpowerpivotgeek.com%2F2010%2F10%2F28%2Fusing-a-sharepoint-list-as-a-data-source%2F&amp;linkname=Using%20a%20SharePoint%20list%20as%20a%20data%20source"><img src="http://powerpivotgeek.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://powerpivotgeek.com/2010/10/28/using-a-sharepoint-list-as-a-data-source/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Pointers: Samples and Tutorials</title>
		<link>http://powerpivotgeek.com/2010/10/04/pointers-samples-and-tutorials/</link>
		<comments>http://powerpivotgeek.com/2010/10/04/pointers-samples-and-tutorials/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 22:49:40 +0000</pubDate>
		<dc:creator>powerpivotgeek</dc:creator>
				<category><![CDATA["Getting Started"]]></category>
		<category><![CDATA[DAX]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://powerpivotgeek.com/2010/10/04/pointers-samples-and-tutorials/</guid>
		<description><![CDATA[<p>I wanted to consolidate all of these into a single posting:</p>

Roadmap to Creating PowerPivot Workbooks in Excel: http://technet.microsoft.com/en-us/library/ee210641.aspx 
PowerPivot for Excel Tutorial: http://technet.microsoft.com/en-us/library/ee835510.aspx 
PowerPivot for Excel Samples: http://go.microsoft.com/fwlink/?LinkID=192753&#38;clcid=0&#215;409 
PowerPivot for Excel DAX Samples: http://go.microsoft.com/fwlink/?LinkID=192754&#38;clcid=0&#215;409 

<p>Enjoy!</p>
<p>_-_-_ Dave</p>
]]></description>
			<content:encoded><![CDATA[<p>I wanted to consolidate all of these into a single posting:</p>
<ul>
<li>Roadmap to Creating PowerPivot Workbooks in Excel: <a title="http://technet.microsoft.com/en-us/library/ee210641.aspx" href="http://technet.microsoft.com/en-us/library/ee210641.aspx">http://technet.microsoft.com/en-us/library/ee210641.aspx</a> </li>
<li>PowerPivot for Excel Tutorial: <a title="http://technet.microsoft.com/en-us/library/ee835510.aspx" href="http://technet.microsoft.com/en-us/library/ee835510.aspx">http://technet.microsoft.com/en-us/library/ee835510.aspx</a> </li>
<li>PowerPivot for Excel Samples: <a href="http://go.microsoft.com/fwlink/?LinkID=192753&amp;clcid=0x409">http://go.microsoft.com/fwlink/?LinkID=192753&amp;clcid=0&#215;409</a> </li>
<li>PowerPivot for Excel DAX Samples: <a href="http://go.microsoft.com/fwlink/?LinkID=192754&amp;clcid=0x409">http://go.microsoft.com/fwlink/?LinkID=192754&amp;clcid=0&#215;409</a> </li>
</ul>
<p>Enjoy!</p>
<p>_-_-_ Dave</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fpowerpivotgeek.com%2F2010%2F10%2F04%2Fpointers-samples-and-tutorials%2F&amp;linkname=Pointers%3A%20Samples%20and%20Tutorials"><img src="http://powerpivotgeek.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://powerpivotgeek.com/2010/10/04/pointers-samples-and-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerPivot.com demos are running again</title>
		<link>http://powerpivotgeek.com/2010/08/06/powerpivot-com-demos-are-running-again/</link>
		<comments>http://powerpivotgeek.com/2010/08/06/powerpivot-com-demos-are-running-again/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 01:38:20 +0000</pubDate>
		<dc:creator>powerpivotgeek</dc:creator>
				<category><![CDATA[Cool demo]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://powerpivotgeek.com/2010/08/06/powerpivot-com-demos-are-running-again/</guid>
		<description><![CDATA[<p>For those interested, I’ve been able to get some of the PowerPivot demos running again. Here is a quick status:</p>


Contoso Retail Warehouse workbook: RUNNING!
NFL Stats: (not yet – it points to the PowerPivot Gallery where the demos are stored!)
USDA Analysis: (not yet – it points to the PowerPivot Gallery where the demos are stored!)
NBA Stats: [...]]]></description>
			<content:encoded><![CDATA[<p>For those interested, I’ve been able to get some of the PowerPivot demos running again. Here is a quick status:</p>
<ol>
<ol>
<li>Contoso Retail Warehouse workbook: RUNNING!<u></u></li>
<li>NFL Stats: (not yet – it points to the PowerPivot Gallery where the demos are stored!)</li>
<li>USDA Analysis: (not yet – it points to the PowerPivot Gallery where the demos are stored!)</li>
<li>NBA Stats: RUNNING!</li>
<li>FAA Bird Strikes Analysis: RUNNING!<u></u></li>
</ol>
</ol>
<p>Here is a quick link to the site: <a href="http://www.powerpivot.com/demo.aspx">http://www.powerpivot.com/demo.aspx</a></p>
<p>As this is now running with RTM bits for everything, we are hope that stability is better than the previous site.</p>
<p>Enjoy!</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fpowerpivotgeek.com%2F2010%2F08%2F06%2Fpowerpivot-com-demos-are-running-again%2F&amp;linkname=PowerPivot.com%20demos%20are%20running%20again"><img src="http://powerpivotgeek.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://powerpivotgeek.com/2010/08/06/powerpivot-com-demos-are-running-again/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Querying data within the PowerPivot Excel client add-in</title>
		<link>http://powerpivotgeek.com/2010/04/27/querying-data-within-the-powerpivot-excel-client-add-in/</link>
		<comments>http://powerpivotgeek.com/2010/04/27/querying-data-within-the-powerpivot-excel-client-add-in/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 19:48:28 +0000</pubDate>
		<dc:creator>powerpivotgeek</dc:creator>
				<category><![CDATA[Client]]></category>
		<category><![CDATA[Engine]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://powerpivotgeek.com/2010/04/27/querying-data-within-the-powerpivot-excel-client-add-in/</guid>
		<description><![CDATA[<p>Recently we have been seeing some users complain about how the PowerPivot Excel client add-in deals with queries. There are three limitations that you need deal with when working with SQL (TSQL, PL/SQL, or whatever) and stored procedures:</p>

The result set must have a name associated with each column. If you are not returning the column [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we have been seeing some users complain about how the PowerPivot Excel client add-in deals with queries. There are three limitations that you need deal with when working with SQL (TSQL, PL/SQL, or whatever) and stored procedures:</p>
<ol>
<li>The result set must have a name associated with each column. If you are not returning the column name, then you must assign an SQL alias to the column. Some query tools allow you to work with ordinal numbers for the columns; some query tools assign a name based on the ordinal (e.g. COLUMN_42); some query tools use a combination of the two. The add-in (and the SSAS engine) does not not – it directly binds to the column name.</li>
<li>You cannot have duplicate column names. Each column name must be unique.</li>
<li>You cannot return multiple rowsets. The client add-in only deals with a single rowset. Some tools allow you to return multiple rowsets but only deal with first one; or the last one. In the client add-in, you must have only a single return rowset. If you are entering queries via SQL then this is typically not a problem – but it has serious complications if you are using stored procedures. If you don’t use “SET NOCOUNT ON” at the beginning of your stored procedure, then a rowset is returned for each SELECT expression, even if that expression is just setting a variable. Thus you must have a “SET NOCOUNT NO” at the start of your stored procedure or the stored procedures are likely to fail with the client add-in.</li>
</ol>
<p>I am just sharing the love here . . . the end result is that you might not be able to use all of your existing queries and stored procedures with the PowerPivot Excel client add-in. Being for-warned is for-armed.</p>
<p>And &#8220;Oh&#8230;&#8221; another possibility issue that you might run into is support for variant datatype. The rowset previewer can handle variant data &#8212; but the Engine cannot.</p>
<p>Enjoy.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fpowerpivotgeek.com%2F2010%2F04%2F27%2Fquerying-data-within-the-powerpivot-excel-client-add-in%2F&amp;linkname=Querying%20data%20within%20the%20PowerPivot%20Excel%20client%20add-in"><img src="http://powerpivotgeek.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://powerpivotgeek.com/2010/04/27/querying-data-within-the-powerpivot-excel-client-add-in/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Howto: Write to the ULS</title>
		<link>http://powerpivotgeek.com/2010/04/14/howto-write-to-the-uls/</link>
		<comments>http://powerpivotgeek.com/2010/04/14/howto-write-to-the-uls/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 16:12:18 +0000</pubDate>
		<dc:creator>powerpivotgeek</dc:creator>
				<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tips and Tricks]]></category>

		<guid isPermaLink="false">http://powerpivotgeek.com/2010/04/14/howto-write-to-the-uls/</guid>
		<description><![CDATA[<p>As more and more folks start to get into PowerPivot and SharePoint, there is a need to programmatically write entries into the ULS. Since all of PowerPivot and all of SharePoint share this common logging infrastructure, why not also include log entries from your own processes. Here is some sample code for doing that:</p>
<p>First via [...]]]></description>
			<content:encoded><![CDATA[<p>As more and more folks start to get into PowerPivot and SharePoint, there is a need to programmatically write entries into the ULS. Since all of PowerPivot and all of SharePoint share this common logging infrastructure, why not also include log entries from your own processes. Here is some sample code for doing that:</p>
<p>First via PowerShell:</p>
<blockquote><p>$diagSvc = [Microsoft.SharePoint.Administration.SPDiagnosticsServices]::Local<br />
$category = new-object Microsoft.SharePoint.Administration.SPDiagnosticsCategory(“My Category”, <br />
                                 [Microsoft.SharePoint.Administration.TraceSeverity]::Monitorable, <br />
                                 [Microsoft.SharePoint.Administration.EventSeverity]::Error )<br />
$diagSvc.WriteTrace(0, $category, [Microsoft.SharePoint.Administration.TraceSeverity]::Monitorable, “Write your log here” )</p></blockquote>
<p> </p>
<p><span id="more-824"></span></p>
<p>Now via C#:</p>
<blockquote><p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using Microsoft.SharePoint.Administration;<br />
namespace WriteIntoULSLog<br />
{ <br />
    public class Program <br />
    { <br />
        public static void Main(string[] args) <br />
        {<br />
            SPDiagnosticsService diagSvc = SPDiagnosticsService.Local; <br />
            diagSvc.WriteTrace( 0, <br />
                new SPDiagnosticsCategory(&#8220;My category&#8221;,  TraceSeverity.Monitorable, EventSeverity.Error),<br />
                    TraceSeverity.Monitorable,<br />
                    &#8220;Writing to the ULS log:  {0}&#8221;,<br />
                    new object[] { &#8220;SharePoint 2010 rocks!&#8221;});<br />
        } <br />
    }<br />
}</p></blockquote>
<p>Enjoy.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fpowerpivotgeek.com%2F2010%2F04%2F14%2Fhowto-write-to-the-uls%2F&amp;linkname=Howto%3A%20Write%20to%20the%20ULS"><img src="http://powerpivotgeek.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://powerpivotgeek.com/2010/04/14/howto-write-to-the-uls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

