<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Customer Feedback SQL Server Content Samples</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/feed.xml</link>
    <description>Agile Content and Samples Development related to SQL Server, Azure and .NET</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:23:05 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to nest XML output in a SQL SELECT statement</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/how-to-nest-xml-output-in-a-sql-select-statement</link>
      <pubDate>Wed, 23 Oct 2013 17:52:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2013/10/23/how-to-nest-xml-output-in-a-sql-select-statement/</guid>
      <description><![CDATA[A customer asked, "How to format [or structure] XML Output to include a sub-group inside the XML"....]]></description>
      <content:encoded><![CDATA[<p>A customer asked, "How to format [or structure] XML Output to include a sub-group inside the XML". The customer is using a SELECT statement with FOR XML, and wants to nest an XML element such as the following:</p>
<p><strong>Before</strong></p>
<p>&lt;BusinessPartner&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;Key&gt;1234&lt;/Key&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;Name&gt;Test Company&lt;/Name&gt; &nbsp;</p>
<p>&lt;/BusinessPartner&gt;</p>
<p><strong>After</strong></p>
<p>&lt;BusinessPartner&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;Key&gt;1234&lt;/Key&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;CompanyDetails&gt;&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Name&gt;Test Company&lt;/Name&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;/CompanyDetails&gt;&nbsp;</p>
<p>&lt;/BusinessPartner&gt;</p>
<p>One way to nest an XML element in T-SQL is to use a subquery. The query for the flat XML output looks something like this:</p>
<p>SELECT [key], name FROM BusinessPartnerTable FOR XML PATH('BusinessPartner')</p>
<p>To create the nested CompanyDetails element, you can use a subquery:</p>
<p>SELECT [key],</p>
<p>&nbsp;&nbsp;&nbsp; (SELECT name as 'name'</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; FROM BusinessPartnerTable c</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; WHERE c.[key] = bp.[key]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; ORDER BY [key]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; FOR XML PATH(''), type</p>
<p>&nbsp;&nbsp;&nbsp; ) as&nbsp;'CompanyDetails'</p>
<p>FROM BusinessPartnerTable bp</p>
<p>GROUP BY [key]</p>
<p>FOR XML path('BusinessPartner'), root('root')</p>
<p>Notice the use of a subquery to nest the CompanyDetails element.</p>
<p>The attached Nested XML Example.sql file shows an example of how to nest XML in a SQL SELECT statement.</p>
<p>Alternatively, you can fine tune a SELECT column to control the output. For example, 'name' as 'CompanyDetails/Name' will nest the 'name' column in a CompanyDetails element.</p>
<p>SELECT<br />&nbsp;&nbsp; [key],<br />&nbsp; &nbsp;'name' as 'CompanyDetails/Name'<br />FROM @BusinessPartner<br />FOR XML PATH('BusinessPartner')</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/45/98/03/Nested%20XML%20Example.sql" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-45-98-03/Nested-XML-Example.sql">Nested XML Example.sql</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Data Explorer and Office 365 - Create a report from an Azure SQL Database source</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/data-explorer-and-office-365-create-a-report-from-an-azure-sql-database-source</link>
      <pubDate>Tue, 12 Mar 2013 14:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2013/03/12/data-explorer-and-office-365-create-a-report-from-an-azure-sql-database-source/</guid>
      <description><![CDATA[This post shows how to create an Excel task report from a &ldquo;Data Explorer&rdquo; query...]]></description>
      <content:encoded><![CDATA[<p>This post shows how to create an Excel task report from a &ldquo;Data Explorer&rdquo; query connected to a Windows Azure SQL Database instance provisioned with Access 2013. In Access 2013, you can create an Access web app. When Access 2013 provisions the web app to Office 365, it creates a complete Windows Azure SQL Database instance for you. Once the SQL Database instance is provisioned, you can create a Data Explorer query to import data from an Access app into Excel. In this blog post, I will use the Access 2013 Project management web app template to show you how to create a Data Explorer query that imports a task report. This post assumes that you have an Office 365 Small Business Premium or above account with the Access 2013 Project management web app template provisioned onto your Office 365 service. For more information about how to provision an Access 2013 app, see <a href="https://office.microsoft.com/en-us/access/" target="_blank">Create custom apps fast without being a developer</a> and <a href="https://office.microsoft.com/en-us/access-help/create-an-access-app-from-a-template-HA102840217.aspx?CTT=1" target="_blank">Create an Access app from a template</a>. To sign up for a free Office 365 Small Business Premium account, see <a href="https://office.microsoft.com/en-us/business/office-online-microsoft-office-365-for-small-businesses-FX103037625.aspx?WT%2Eintid1=ODC%5FENUS%5FFX101785584%5FXT104019732" target="_blank">Office 365 Small Business Premium free 1-month trial</a>.</p>
<p>For more information about the Microsoft &ldquo;Data Explorer&rdquo; Preview for Excel, see <a title="https://www.microsoft.com/en-us/bi/Products/Office.aspx" href="https://www.microsoft.com/en-us/bi/Products/Office.aspx" target="_blank">https://www.microsoft.com/en-us/bi/Products/Office.aspx</a>.</p>
<h4>How to create the task report with an advanced query</h4>
<p>Microsoft &ldquo;Data Explorer&rdquo; Preview for Excel enables you to create advanced queries with the Data Explorer formula language. The Data Explorer Formula Language provides a wide variety of formulas that are used to build expressions. To create an advanced query, you start with a blank query and add query steps that contain Data Explorer formulas. To create a query to shape a task table from the Access 2013 Project management web app, you can use the <strong>Project Task Query</strong> listed below. You need to replace the <strong>Server</strong> <strong>name</strong> and <strong>Database</strong> <strong>name</strong> in the <strong>Sql.Database</strong> formula parameters to connect to the SQL Database instance.</p>
<h5>Project Task Query</h5>
<blockquote>
<p>let</p>
<p>Source = Sql.Database("<strong>{Server name}</strong>.database.windows.net", "<strong>{Database name}</strong>"),</p>
<p>Access.Projects = Source{[Name="Access.Projects"]}[Data],</p>
<p>HiddenOtherColumns = Table.SelectColumns(Access.Projects,{"Project Name", <br />"Access.Tasks"}),</p>
<p>#"Expand Access.Tasks" = Table.ExpandTableColumn(HiddenOtherColumns, "Access.Tasks", <br />{"Task Title", "Description", "Start Date", "Due Date", "Percent Complete"}, <br />{"Access.Tasks.Task <br />Title", "Access.Tasks.Description", "Access.Tasks.Start Date", "Access.Tasks.Due Date", <br />"Access.Tasks.Percent Complete"}),</p>
<p>RenamedColumns = Table.RenameColumns(#"Expand Access.Tasks",{{"Access.Tasks.Task <br />Title", "Task Title"}, {"Access.Tasks.Description", "Description"}, {"Access.Tasks.Start Date", <br />"Tasks Start Date"}, {"Access.Tasks.Due Date", "Tasks Due Date"}, {"Access.Tasks.Percent <br />Complete", "Task Percent Complete"}})</p>
<p>in</p>
<p>RenamedColumns</p>
</blockquote>
<h5>Parameters to replace</h5>
<p>In the <strong>Project Task Query</strong>, you must replace the <strong>Sql.Database {Server name}</strong> and <strong>{Database name}</strong> parameters. You get the SQL Database instance connection information from the Access 2013<strong> SQL Server Connection Information</strong> dialog box.</p>
<p><strong>To get the SQL Database instance connection information for your Access app:</strong></p>
<p>1. Open your Access 2013 app.</p>
<p>2. Click the <strong>FILE</strong> ribbon tab.</p>
<p>3. Click <strong>Manage</strong> &gt; <strong>Enable Read-Only Connection</strong>. <br /> <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/8780.image_192AD558.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/8780.image_5F00_192AD558.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5657.image_thumb_742D14DE.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5657.image_5F00_thumb_5F00_742D14DE.png" alt="image" width="552" height="340" border="0" /></a></p>
<p>4. Click <strong>Manage</strong> &gt; <strong>View Read-Only Connection Information</strong>. The <strong>SQL Server Connection Information</strong> dialog box displays the SQL Database instance <strong>Server</strong>, <strong>Database</strong>, <strong>UserName</strong>, and <strong>Password</strong>.</p>
<p>5. In the Access app <strong>Project Task Query</strong>, change <strong>{Server name}</strong>.database.windows.net to the <strong>Server</strong> name, and change <strong>{Database name}</strong> to the <strong>Database</strong> name.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3326.image_1E9945FC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3326.image_5F00_1E9945FC.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/7624.image_thumb_3E481FC4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/7624.image_5F00_thumb_5F00_3E481FC4.png" alt="image" width="394" height="191" border="0" /></a></p>
<h5>To create the advanced query</h5>
<p>With the SQL Server connection information, you can now create the Data Explorer query to import a task report into Excel.</p>
<p><strong>To enable advanced query editing</strong></p>
<p>1. In the <strong>DATA EXPLORER</strong> ribbon tab, in the <strong>Options</strong> group, click <strong>Settings</strong>.</p>
<p>2. In the <strong>Settings</strong> dialog box, click <strong>Enable Advanced Query Editing</strong>.</p>
<p>Once you enable advanced query editing, you can create an empty query by using the <strong>Write Query</strong> option in the <strong>From Other Sources</strong> ribbon menu.</p>
<p><strong>To create an advanced query</strong></p>
<p>1. In the <strong>DATA EXPLORER</strong> ribbon tab, click <strong>From Other Sources</strong> &gt; <strong>Write Query</strong>.</p>
<p>2. In the <strong>Edit Query</strong> dialog box, add query steps that contain Data Explorer formulas by using the formula bar or click the query script icon ( ) to display the <strong>Edit Query</strong> formulas dialog box.</p>
<p>3. In the <strong>Edit Query</strong> dialog box, replace the default query with the <strong>Project Task Query</strong>.</p>
<p>4. Click <strong>Edit credentials. </strong>In the<strong> SQL Server Connection Information</strong> dialog box, enter the SQL Database instance <strong>UserName</strong> and <strong>Password</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3007.image_6BC93F87.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3007.image_5F00_6BC93F87.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1447.image_thumb_7DA5D354.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1447.image_5F00_thumb_5F00_7DA5D354.png" alt="image" width="276" height="41" border="0" /></a></p>
<p>5. In the <strong>Access a Microsoft SQL Database</strong> dialog box, enter the SQL Database instance <strong>UserName</strong> and <strong>Password</strong>.</p>
<p>6. Click <strong>Save</strong>. Data Explorer builds a query from the custom <strong>Project Task Query</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6646.image_5D1E93A2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6646.image_5F00_5D1E93A2.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3513.image_thumb_4A6999EB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3513.image_5F00_thumb_5F00_4A6999EB.png" alt="image" width="541" height="317" border="0" /></a></p>
<p>7. Click <strong>Done</strong>.</p>
<p>After you click <strong>Done</strong>, Data Explorer executes the query and inserts a task report. To update the task worksheet, you simple click <strong>Refresh</strong> in the <strong>QUERY</strong> ribbon tab.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3010.image_54BABE4B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3010.image_5F00_54BABE4B.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3021.image_thumb_3B52BB11.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3021.image_5F00_thumb_5F00_3B52BB11.png" alt="image" width="543" height="379" border="0" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>10 reasons to use Data Explorer from the Community</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/10-reasons-to-use-data-explorer-from-the-community</link>
      <pubDate>Tue, 12 Mar 2013 14:33:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2013/03/12/10-reasons-to-use-data-explorer-from-the-community/</guid>
      <description><![CDATA[Before starting this post, I want to thank all of our customers for commenting about how much they...]]></description>
      <content:encoded><![CDATA[<p>Before starting this post, I want to thank all of our customers for commenting about how much they love Data Explorer. Keep on giving us your feedback, we are reading your comments, and plan to create more tutorials based on your comments. In fact, please let me know what tutorials you would like in our product documentation that would help the Data Explorer community the most.</p>
<p>As of today, here is a partial list of how customers plan to use Data Explorer.</p>
<ol>
<li>Build a simple table showing your sales broken down by product in an Excel spreadsheet, you could build this quite easily with Data Explorer. Thanks Chris Webb for this observation.</li>
<li>Create a query from your Facebook likes that render an Excel chart. Check out <a href="https://t.co/QjuuYZAbcx" target="_blank">pic.twitter.com/QjuuYZAbcx</a>.</li>
<li>Import data from multiple log files. Check out <a href="https://sqlserverpedia.com/blog/sql-server-bloggers/importing-data-from-multiple-log-files-using-data-explorer/" target="_blank">this blog post</a>.</li>
<li>Traverse the Facebook Graph. Check out <a href="https://sqlblog.com/blogs/jamie_thomson/archive/2013/02/28/traversing-the-facebook-graph-using-data-explorer.aspx" target="_blank">this blog post</a>.</li>
<li>Pull data into PowerPivot from new data sources, such as XML, Facebook, and File Folders as refreshable connections. Check out <a href="https://www.powerpivotpro.com/2013/03/introducing-data-explorer/" target="_blank">this blog post</a>.</li>
<li>Import data from a wide variety of traditional and non-traditional data sources including CSV, Windows Azure SQL Database, Oracle, MySQL, SharePoint list, OData Feed, Facebook.</li>
<li>Merge and shape data sources to match your data analysis requirements or prepare it for further analysis and modeling by tools such as PowerPivot and PowerView.</li>
<li>Connect to Big Data in Excel 2013.</li>
<li>Self-service ETL tool for the Excel power user. Enhances the self-service Business Intelligence experience in Excel by simplifying data discovery and access. Check out <a href="https://www.sqlservercentral.com/blogs/jamesserra/2013/03/05/microsoft-data-explorer/" target="_blank">this blog post</a>.</li>
<li>Create dynamic lookups. Check out <a href="https://www.mattmasson.com/2013/03/dynamic-lookups-with-data-explorer/" target="_blank">this blog post</a>.</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Data Explorer: An introduction to table relationships and the Expand operation</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/data-explorer-an-introduction-to-table-relationships-and-the-expand-operation</link>
      <pubDate>Thu, 07 Mar 2013 18:34:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2013/03/07/data-explorer-an-introduction-to-table-relationships-and-the-expand-operation/</guid>
      <description><![CDATA[This post is an introduction to table relationship concepts as related to the Data Explorer Expand...]]></description>
      <content:encoded><![CDATA[<p>This post is an introduction to table relationship concepts as related to the Data Explorer <strong>Expand</strong> operation. The <strong>Expand</strong> operation makes combining data together really easy.</p>
<p>One of the goals of efficient data management design is to remove duplicate data that is contained in a data source. To achieve that goal, a data management application is divided into many subject tables so that each fact is represented only once. For example, an invoice <span style="background-color: #ffffff;">design might</span><span style="background-color: #ffffff;"> have</span> an <strong>Order</strong> table and related <strong>Order_Details</strong> table, in which one order has many order details. To bring the divided information back together, the columns in the tables must be coordinated so that they show information about the same order. This coordination is accomplished by using table relationships. A table relationship works by matching data in key columns &mdash; often a column with the same name in both tables. In most cases, these matching columns are the <strong>primary key</strong> from one table, which provides a unique identifier for each record, and a <strong>foreign key</strong> in the other table. An order can be associated with order line item details by creating a table relationship between an <strong>OrderID</strong> column in the <strong>Order</strong> table and <strong>Order_Details</strong> table. In this example, the <strong>Order</strong> table is the <strong>primary table</strong> and the <strong>Order_Details</strong> table is the <strong>related table</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/4370.image_1EA12863.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/4370.image_5F00_1EA12863.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5001.image_thumb_768E7943.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5001.image_5F00_thumb_5F00_768E7943.png" alt="image" width="698" height="505" border="0" /></a></p>
<p>In Microsoft &ldquo;Data Explorer&rdquo; Preview for Excel, you create a query to bring data source tables back together. In the <strong>Order</strong> example, you can use the <strong>Expand</strong> query operation to bring together <strong>Order_Details</strong> records that are related to the <strong>Order</strong> table, to combine order line items with each order. The <strong>Expand</strong> operation widens a subject table to include columns from a related table and expands a subject table with values from the related table. To illustrate:</p>
<p>A subject table has columns <strong>A</strong> and <strong>B</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3022.image_355FAE45.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3022.image_5F00_355FAE45.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3835.image_thumb_667EE8E5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3835.image_5F00_thumb_5F00_667EE8E5.png" alt="image" width="100" height="68" border="0" /></a></p>
<p>A related table has column <strong>C</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5657.image_5E1B138E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5657.image_5F00_5E1B138E.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5657.image_thumb_5D42ADA4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5657.image_5F00_thumb_5F00_5D42ADA4.png" alt="image" width="221" height="110" border="0" /></a></p>
<p>The <strong>Expand</strong> operation widens a subject table to include column <strong>C</strong> and expands a subject table with related values from the data source that contains column <strong>C</strong>.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3823.image_3BE30808.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3823.image_5F00_3BE30808.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6558.image_thumb_3B0AA21E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6558.image_5F00_thumb_5F00_3B0AA21E.png" alt="image" width="152" height="89" border="0" /></a></p>
<p>In the <strong>Order</strong> example, the <strong>Expand</strong> operation widens an <strong>Order</strong> table to include the <strong>Order_Details.ProductID</strong>, <strong>Order_Details.UnitPrice</strong>, and <strong>Order_Details.Quantity</strong> columns to bring together <strong>Order</strong> records and related <strong>Order_Details</strong> records. For more information about the <strong>Expand</strong> operation, see <a href="https://office.microsoft.com/en-us/excel-help/redir/HA103993865.aspx?CTT=5&amp;origin=HA104003813">Expand a column containing an associated table</a> and the <a href="https://office.microsoft.com/en-us/excel-help/redir/HA103993145.aspx?CTT=5&amp;origin=HA104003813">Combine data from multiple data sources</a> tutorial.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3326.image_55D6C82A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3326.image_5F00_55D6C82A.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1325.image_thumb_7E25FA7E.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1325.image_5F00_thumb_5F00_7E25FA7E.png" alt="image" width="669" height="519" border="0" /></a></p>
<p>For more information about the Microsoft &ldquo;Data Explorer&rdquo; Preview for Excel, see <a title="https://www.microsoft.com/en-us/bi/Products/Office.aspx" href="https://www.microsoft.com/en-us/bi/Products/Office.aspx">https://www.microsoft.com/en-us/bi/Products/Office.aspx</a>.</p>]]></content:encoded>
    </item>
    <item>
      <title>Migrate a WCF Data Service to Windows Azure</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/migrate-a-wcf-data-service-to-windows-azure</link>
      <pubDate>Fri, 25 Jan 2013 09:59:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2013/01/25/migrate-a-wcf-data-service-to-windows-azure/</guid>
      <description><![CDATA[I just published a step by step guide to publish and consume a Windows Azure WCF Data Service...]]></description>
      <content:encoded><![CDATA[<p>I just published a step by step guide to publish and consume a Windows Azure WCF Data Service connected to an Azure SQL Database using Azure Access Control Service (ACS) claims-based authentication.</p>
<p>The content has several lessons about exposing an Azure SQL Database on Windows Azure as a WCF Data Service. You can download a sample Console app to learn how to use an ACS token to connect to a Windows Azure cloud service, and use the token to LINQ query a Windows Azure WCF Data Service. In addition, the sample application shows how to use EncryptString to save sensitive data (user name and password) on the client.</p>
<p>You can download the word document and sample app at <a href="https://azuresql.codeplex.com/releases/view/100469">Migrate a WCF Data Service to Windows Azure Lessons</a> on our Windows Azure SQL CodePlex site.</p>
<h2>Lesson 1 - Create a local WCF Data Service that connects to Azure SQL Database</h2>
<p><strong>How to deploy the sample AdventureWorksLT2012_Azure database to Azure SQL Database</strong></p>
<p>In lesson 1, you learn how to deploy a SQL Server database to an Azure SQL Database account, and create a WCF Data Service on localhost that exposes a Product OData resource including a product image resource stream.</p>
<p><strong>Restricting the SQL Server User</strong></p>
<p>When creating an Azure WCF Data Service, you should create web user accounts on your Azure SQL Database. For more information about adding users to your Azure SQL Database, see<a href="https://blogs.msdn.com/b/sqlazure/archive/2010/06/21/10028038.aspx"> Adding Users to Your SQL Azure Database</a>.</p>
<p><strong>How to create a Visual Studio 2012 Windows Azure Cloud Service on localhost</strong></p>
<p>You use Visual Studio 2012 with the Windows Azure SDK installed to create a Windows Azure Cloud Service on localhost.</p>
<p><strong>How to create a Named Resource class to stream an image</strong></p>
<p>This section shows you how to you create a named resource class to expose ThumbnailPhoto as an Edm.Stream entity type.</p>
<p><strong>How to encrypt a connection string for testing on localhost</strong></p>
<p>This section shows you how to protect sensitive connection string data by encrypting the web.config connection string for testing on localhost.</p>
<h2>Lesson 2 - Publish a local WCF Data Service to a Windows Azure Cloud Service</h2>
<p>In this lesson, you publish the local WCF Data Service created in lesson 1 to a Windows Azure Cloud Service. Sign up for a<a href="https://www.windowsazure.com/en-us/pricing/free-trial/">Windows Azure 90 day free trial</a>, and follow the Windows Azure Account setup instructions.</p>
<p><strong>How to publish a Windows Azure Cloud Service</strong></p>
<p>A step by step guide to publish a local WCF Data Service to a Windows Azure Cloud Service using Visual Studio 2012.</p>
<p><strong>How to encrypt a connection string for Windows Azure</strong></p>
<p>In this section, you encrypt a connection string by opening a Remote Desktop session into your Windows Azure Compute VM.</p>
<h2>Lesson 3 - How to implement claims-based authentication using Windows Azure ACS 2.0</h2>
<p>In lesson3, you learn how to implement Windows Azure claims-based authentication using the Azure Access Control Service 2.0 (ACS). ACS is a cloud-based service that provides an easy way of authenticating and authorizing users to gain access to your web applications and services while allowing the features of authentication and authorization to be factored out of your code.</p>
<p><strong>How to configure a user name and password ACS Service Identity</strong></p>
<p>In ACS, a service identity is a credential that is registered with an ACS namespace and is intended for use by autonomous applications or clients. In this section, you learn how to configure an ACS Service Identity. You also learn how to configure a Relying Party Application using the Windows Azure portal.</p>
<p><strong>How to obtain service credentials for an HttpModule</strong></p>
<p>In this section, you learn how to create a security module that implements IHttpModule to validate a Windows Azure ACS token to authenticate a WCF Data Service user.</p>
<p><strong>How to configure web.config for a Windows Azure WCF Data Service</strong></p>
<p>In this section, you configure the AdventureWorksLTWindowsAzureWebRole web.config file.</p>
<p><strong>How to create an Azure custom error page</strong></p>
<p>In this section, you create a custom error page that is displayed when access is denied due to invalid credentials.</p>
<h2>Lesson 4 - How to configure a Windows Azure WCF Data Service client App for Claims-based authentication</h2>
<p>The AzureODataConsoleApp sample console application displays a LoginForm where you enter your Windows Azure ACS user name and password. The sample then connects to your claims-based Windows Azure WCF Data Service using an SWT token retuned using your credentials. A token allows a user to enter their username and password in order to obtain a time limited key token which allows them to fetch a specific resource - without using their username and password. The AzureWebClient.GetTokenFromACS() method in the tutorial source code returns a Windows Azure ACS SWT token representing a service resource scope for a username and password.</p>
<p>The AzureODataConsoleApp demonstrates how to:</p>
<ul>
<li>Get an ACS SWT token using AzureWebClient.GetTokenFromACS().</li>
<li>Get an OData stream using AzureWebClient.OpenRead() passing the SWT token.</li>
<li>Create a LINQ query to project the OData stream to a List&lt;List&lt;EntityProperty&gt;&gt;.</li>
<li>Save a bitmap from a web response when querying a named resource stream.</li>
<li>Use a Login Form to get user name and password</li>
<li>Use EncryptString to save sensitive data on the client.</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>How to publish Excel worksheets to Azure SQL Database using SSIS</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/how-to-publish-excel-worksheets-to-azure-sql-database-using-ssis</link>
      <pubDate>Tue, 13 Nov 2012 09:44:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2012/11/13/how-to-publish-excel-worksheets-to-azure-sql-database-using-ssis/</guid>
      <description><![CDATA[Introduction  In this tutorial you will learn the fundamentals of how to upload an Excel worksheet...]]></description>
      <content:encoded><![CDATA[<h3>Introduction</h3>  <p>In this tutorial you will learn the fundamentals of how to upload an Excel worksheet to Azure SQL Database using SQL Server Integration Services (SSIS). This tutorial assumes prior experience with SSIS and Windows Azure SQL Database. Upon completing this tutorial, you will have a sample database on Windows Azure published from an Excel 2007 or above worksheet. This tutorial will not illustrate data retry scenarios since the example worksheet contains a small data set. However, when the amount of data becomes significant, you will need a retry strategy to compensate for network bandwidth and latency, and the amount of (shared) resources available in a physical hardware node hosting a database.</p>  <p>SSIS is a platform for building enterprise-level data integration and data transformations solutions. You use SSIS packages containing tasks to solve complex business data migration problems. Publishing an Excel worksheet to an Azure SQL Database is similar to an on-premise solution except an Azure SQL table must have a clustered index. For this tutorial, you will configure a Data Flow Task containing an <a href="https://msdn.microsoft.com/en-us/library/ms141683.aspx">Excel Source</a> task and <a href="https://msdn.microsoft.com/en-us/library/bb895291.aspx">ADO NET Destination</a> task to publish a worksheet to an Azure SQL Database. </p>  <h3>Table of Contents</h3>  <ul>   <li><a href="#Prerequisites">Prerequisites</a></li>    <li><a href="#Overview">Overview</a></li>    <li><a href="#Step1">Step 1: Download the sample OlympicsData workbook</a></li>    <li><a href="#Step2">Step 2: Setup the sample Olympics Azure SQL Database</a></li>    <li><a href="#Step3">Step 3: Create an SSIS Package that Uploads Data from Excel Worksheet to Azure SQL Database</a></li>    <li><a href="#64bit">How to configure an Excel Source task on a 64-bit machine</a></li>    <li><a href="#Retry">Retry strategies</a></li>    <li><a href="#Alternative">Alternative data movement strategies</a></li>    <li><a href="#Ref">References</a></li>  </ul>  <h3><a name="Prerequisites"></a><a href="#Prerequisites">Prerequisites</a></h3>  <ul>   <li>Azure SQL Database Account. Sign up for a <a href="https://www.windowsazure.com/en-us/pricing/free-trial/%20and%20follow%20the%20Windows%20Azure%20Account%20setup%20instructions">Windows Azure 90 day free trial</a> which includes 1 SQL database, and follow the Windows Azure Account setup instructions. </li> </ul>  <ul>   <li>Excel 2007 or above.</li>    <li>Example OlympicsData workbook located at https://msftdbprodsamples.codeplex.com/downloads/get/528843.</li>    <li>SQL Server 2012 Developer, Standard, or Enterprise with SQL Server Data Tools installed. </li>  </ul>  <blockquote>   <p><b>Note</b> To test this tutorial without an Azure SQL Database account, you can use an on-premise SQL Server 2012 database. Any SQL Server 2012 instance will work including <a href="https://msdn.microsoft.com/en-us/library/hh510202.aspx">SQL Server 2012 Express LocalDB</a>.</p>  </blockquote>  <h3><a name="Overview"></a><a href="#Overview">Overview</a></h3>  <p>After following this tutorial, you will publish a sample Excel worksheet to an Azure SQL Database using SSIS.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1452.image_15767145.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1452.image_5F00_15767145.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1057.image_thumb_150A3E50.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1057.image_5F00_thumb_5F00_150A3E50.png" width="856" height="501" /></a></p>  <h3><a name="Step1"></a>Step 1: Download the sample OlympicsData workbook</h3>  <p>For this tutorial, you will start with an Excel 2007 or above workbook containing four worksheets: Disciplines, Events, Medalists, and Sports. Download the worksheet from our CodePlex site: https://msftdbprodsamples.codeplex.com/downloads/get/528843.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6505.image_4A026985.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6505.image_5F00_4A026985.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/0654.image_thumb_57687C8B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/0654.image_5F00_thumb_5F00_57687C8B.png" width="425" height="384" /></a></p>  <p>Olympics data © The Guardian, and reproduced with The Guardian permission&#160; </p>  <h3><a name="Step2"></a>Step 2: Setup the sample Olympics Azure SQL Database</h3>  <p>There are two primary methods to create an Azure SQL Database: Management Portal for SQL Database or SQL Server Management Studio on your desktop. For details on Getting Started with Windows Azure SQL Database, see <a href="https://www.windowsazure.com/en-us/manage/services/sql-databases/getting-started-w-sql-databases/">Getting Started with Windows Azure SQL Database</a>.</p>  <p>From SQL Server Management Studio (SSMS):</p>  <ol>   <li>Connect to your Azure SQL Database account, and the master database.</li>    <li>Create the <strong>Olympics</strong> database:</li>  </ol>  <blockquote>   <pre>-- NOTE: For Azure SQL Database, you must be connected to the master database to </pre>

  <pre>-- create a new database.</pre>

  <pre>USE master</pre>

  <pre>GO</pre>

  <pre>IF EXISTS (SELECT [name] FROM [sys].[databases] WHERE [name] = N'Olympics')</pre>

  <pre>&#160;&#160;&#160; DROP DATABASE [Olympics]</pre>

  <pre>GO</pre>

  <pre>CREATE DATABASE [Olympics]</pre>

  <pre>GO</pre>
</blockquote>

<h3><a name="Step3"></a><a href="#Step3">Step 3: Create an SSIS Package that Uploads Data from Excel Worksheet to Azure SQL Database</a></h3>

<p>Unlike SQL Server, every table in Azure SQL Database must have a clustered index. A clustered index is usually created on the primary key column of the table.</p>

<blockquote>
  <p><b>Note</b> The ADO NET Destination task returns the following error if your Azure SQL Database table does not have a clustered index:</p>
</blockquote>

<blockquote>
  <p>[ADO NET Destination [2]] Error: An exception has occurred during data insertion, the message returned from the provider is: Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.</p>
</blockquote>

<h4><a href="ExcelAzurePackage">To create the Excel worksheet to Azure SQL Database SSIS package</a></h4>

<p>To publish an Excel worksheet to Azure SQL Database, your package will contain a Data Flow Task, Excel Source task, and ADO NET Destination.</p>

<p>1) Create an SSIS project.</p>

<p>2) Drop a <b>Data Flow Task</b> onto the <b>Control Flow</b> design surface, and double click the Data Flow Task.</p>

<p>3) Drop an <b>Excel Source</b> onto the Data Flow design surface.</p>

<blockquote>
  <p><b>Note</b> When using the <b>Excel Source</b> task on a 64-bit machine, set Run64BitRuntime to False. For more information, see <a href="file:///C:/Projects/I Can/Publish an Excel worksheet to Azure SQL DB/#_How_to_configure">How to configure an Excel Source task on a 64-bit machine</a> in this tutorial.</p>
</blockquote>

<p>4) Double click the <b>Excel Source</b> task.</p>

<p>5) Click <b>New</b> next to the <strong>Excel connection manager</strong> drop down.</p>

<p>6) Browse to <strong>OlympicsData.xlsx</strong>.</p>

<p>7) Click <strong>OK</strong>.</p>

<p>8) Select <strong>“Disciplines$”</strong> from the <b>Name of the Excel sheet</b> drop down, and click <b>Preview</b>.</p>

<p>9) Click <strong>OK</strong>.</p>

<p>10) Drop an <b>ADO NET Destination</b> task under the <b>Excel Source</b> task.</p>

<p>11) Connect a <b>Data Flow Path</b> from the Excel Source to the ADO NET Destination.</p>

<p>12) Double click the ADO NET Destination, and click <b>Yes</b> on the “This component has no available input columns” dialog form.</p>

<p>13) Click <b>New</b> next to Connection manager.</p>

<p>14) Click <b>New</b> on the <b>Configure ADO.NET Connection Manager</b> dialog form.</p>

<p>15) Enter your Azure SQL Database configuration settings (or SQL Server connection settings for on-premise):</p>

<blockquote>
  <p>a. Enter your Azure <strong>server name</strong> as <strong>{servername}.database.windows.net</strong>.</p>

  <p>b. Select <strong>SQL Server Authentication</strong>, and enter your SQL database <strong>user name</strong> and <strong>password</strong>.</p>

  <p>c. Select the Olympics database from the Connect to a database drop down. </p>

  <p>d. Click <b>All.</b></p>

  <p>e. Set <strong>Connect Timeout</strong> to <strong>500</strong> to increase the length of time (in seconds) to wait for a connection to Azure.</p>

  <p>f. Set <strong>Encrpt</strong> to <strong>True</strong> to encrypt the SQL Server connection string.</p>
</blockquote>

<blockquote>
  <p>g. Since the sample worksheet data is small, you can use the default packet size. For larger data sets, you should increase network packet size.</p>
</blockquote>

<p>16) Click <b>Test Connection</b>.</p>

<p>17) Click <strong>OK</strong>.</p>

<p>18) Click <strong>OK</strong> (ADO NET Connection Manager).</p>

<p>19) Click <b>New</b> next to Use a table or view.</p>

<p>20) Replace the default Create Table statement with an Azure SQL Database Create Table statement:</p>

<blockquote>
  <p><b>Note </b>The default [DisciplineID] and [SportID] column types are changed to int to optimize the database size, and [DisciplineID] is set as the clustered index.</p>
</blockquote>

<blockquote>
  <pre>CREATE TABLE [Discipline] (</pre>

  <pre>&#160; [DisciplineID] int NOT NULL IDENTITY, </pre>

  <pre>&#160; [Discipline] nvarchar(255),</pre>

  <pre>&#160; [SportID]int,</pre>

  <pre>&#160; CONSTRAINT [PK_Discipline_ID] PRIMARY KEY CLUSTERED </pre>

  <pre>&#160; (</pre>

  <pre>&#160;&#160;&#160; [DisciplineID] ASC</pre>

  <pre>&#160; )</pre>

  <p>)</p>
</blockquote>

<p>21) Click <strong>OK</strong>, and <strong>OK</strong> on the “Select a table or a view from the list” dialog form.</p>

<p>22) From the <b>Use a table or view</b> drop down, select &quot;dbo&quot;.&quot;Discipline&quot;, and click Preview.</p>

<p>23) Click <b>Mappings</b> and accept the default Available Input Columns from the Excel worksheet and Available Destination Columns from the ADO.NET Destination Columns.</p>

<p>24) Click <strong>OK</strong>.</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6232.image_1EEF2FBB.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6232.image_5F00_1EEF2FBB.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2045.image_thumb_5EB91640.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2045.image_5F00_thumb_5F00_5EB91640.png" width="264" height="172" /></a></p>

<p><b>Final Data Flow sequence of tasks</b></p>

<h4><a href="#Publish">To publish the Excel worksheet to Azure SQL Database SSIS package</a></h4>

<p>1) Right click the design surface, click <b>Execute Task</b> to publish the sample worksheet to Azure SQL Database.</p>

<p><b>Note</b> You can repeat this process to publish multiple Excel worksheets to Azure SQL Database. </p>

<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1462.image_1E82FCC6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1462.image_5F00_1E82FCC6.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/0550.image_thumb_0C3A3604.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/0550.image_5F00_thumb_5F00_0C3A3604.png" width="265" height="191" /></a></p>

<p><b>Successful Data Flow execution</b></p>

<p>To create each Olympics table that corresponds to each OlympicsData worksheet, run the following SQL script:</p>

<blockquote>
  <p>USE [Olympics]</p>

  <p>GO</p>

  <p>-- Disciplines Worksheet. This table was created in step 3</p>

  <p>IF EXISTS (SELECT [name] FROM [sys].[tables] WHERE [name] = N'Discipline')</p>

  <p>DROP TABLE [Discipline]</p>

  <p>GO</p>

  <p>CREATE TABLE [Discipline] (</p>

  <p>[DisciplineID] int NOT NULL IDENTITY,</p>

  <p>[Discipline] nvarchar(255),</p>

  <p>[SportID]int,</p>

  <p>CONSTRAINT [PK_Discipline_ID] PRIMARY KEY CLUSTERED</p>

  <p>(</p>

  <p>[DisciplineID] ASC</p>

  <p>)</p>

  <p>)</p>

  <p>GO</p>

  <p>-- Events Worksheet</p>

  <p>IF EXISTS (SELECT [name] FROM [sys].[tables] WHERE [name] = N'Event')</p>

  <p>DROP TABLE [Event]</p>

  <p>GO</p>

  <p>CREATE TABLE [Event] (</p>

  <p>[EventID] int NOT NULL IDENTITY,</p>

  <p>[DisciplineID] int,</p>

  <p>[Event] nvarchar(255),</p>

  <p>CONSTRAINT [PK_Event_ID] PRIMARY KEY CLUSTERED</p>

  <p>(</p>

  <p>[EventID] ASC</p>

  <p>)</p>

  <p>)</p>

  <p>GO</p>

  <p>-- Medalists Worksheet</p>

  <p>IF EXISTS (SELECT [name] FROM [sys].[tables] WHERE [name] = N'Medalist')</p>

  <p>DROP TABLE Medalist</p>

  <p>GO</p>

  <p>CREATE TABLE Medalist (</p>

  <p>[MedalistID] int NOT NULL IDENTITY,</p>

  <p>[Event] nvarchar(255),</p>

  <p>[Edition] datetime,</p>

  <p>[Athlete] nvarchar(255),</p>

  <p>[NOC] nvarchar(255),</p>

  <p>[Gender] nvarchar(255),</p>

  <p>[Medal] nvarchar(255),</p>

  <p>[Season] nvarchar(255),</p>

  <p>[MedalValue] float,</p>

  <p>[DisciplineID]int,</p>

  <p>[SportID] int,</p>

  <p>CONSTRAINT [PK_Medalist_ID] PRIMARY KEY CLUSTERED</p>

  <p>(</p>

  <p>[MedalistID] ASC</p>

  <p>)</p>

  <p>)</p>

  <p>GO</p>

  <p>-- Sports Worksheet</p>

  <p>IF EXISTS (SELECT [name] FROM [sys].[tables] WHERE [name] = N'Sport')</p>

  <p>DROP TABLE Sport</p>

  <p>GO</p>

  <p>CREATE TABLE [Sport] (</p>

  <p>[SportID] int NOT NULL IDENTITY,</p>

  <p>[Sport] nvarchar(255),</p>

  <p>CONSTRAINT [PK_Sport_ID] PRIMARY KEY CLUSTERED</p>

  <p>(</p>

  <p>[SportID] ASC</p>

  <p>)</p>

  <p>)</p>

  <p>GO</p>
</blockquote>

<h3><a name="64bit">How to configure an Excel Source task on a 64-bit machine</a></h3>

<p>The Excel Source task does not have a 64-bit OLE DB driver. To configure an Excel Source task on a 64-bit machine, set Run64BitRuntime to False on the Debugging node on the SSIS solution properties dialog form.</p>

<p><b>Note</b> When Run64BitRuntime is True, SSIS will generate the follow error:</p>

<p>SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager &quot;Excel Connection Manager&quot; failed with error code 0xC0209303. There may be error messages posted before this with more information on why the AcquireConnection method call failed.</p>

<h3><a name="Retry"></a><a href="#Retry">Retry strategies</a></h3>

<p>This tutorial does not provide details about retry strategies when moving data to Azure SQL Database. When the amount of data becomes significant, this operation may present some critical challenges that will require a slightly different approach compared to on-premises solutions, mainly due to public network bandwidth and latency, and the amount of (shared) resources available in physical hardware nodes hosting a database in the cloud environment to execute the data loading phase.</p>

<ul>
  <li>For cases of a single package, incorporate retry by</li>

  <ul>
    <li>Determining the maximum number of times the package should retry before failing. </li>

    <li>Setting up a variable to store your success status. <b></b></li>

    <li>Using a FOR loop to retry up to the maximum number of retries if the data flow is not successful.</li>
  </ul>

  <li>Move the worksheet into an on-premise SQL Server database. Then, use SQL Agent and specify what action SQL Server should take if a failure occurs during job execution.</li>

  <li>Develop custom source or destination components for SSIS and incorporate <a href="https://msdn.microsoft.com/en-us/library/hh680901(PandP.50).aspx">transient fault handling</a>. </li>

  <li>Execute packages programmatically, and place the retry of failed packages into the programmatic execution of the package. You accomplish this by checking the execution status after package execution, and retrying if the package execution was unsuccessful.</li>
</ul>

<h3><a name="Alternative">Alternative data movement strategies</a></h3>

<p>This tutorial illustrated how to use SSIS to publish an Excel worksheet to Azure SQL Database. However, there are other data movement solutions you can consider:</p>

<ul>
  <li>Use the <a href="https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx">SqlBulkCopy</a> class in ADO.NET.</li>

  <li><a href="https://msdn.microsoft.com/en-us/library/aa337544.aspx">Run a Bulk Copy Program (BCP.EXE)</a> import / export script. See <a href="https://msftdbprodsamples.codeplex.com/releases/view/37304%20for%20an%20example%20AdventureWorks2012">https://msftdbprodsamples.codeplex.com/releases/view/37304</a> for an AdventureWorks2012 on Azure SQL Database sample. </li>
</ul>

<blockquote>
  <p><b>Note</b> When running the AdventureWorks2012 on Azure SQL Database sample, change the batch size to 10000 from the default 1000 and the packet size to 16000 from the default 4000.</p>
</blockquote>

<ul>
  <li><a href="https://msdn.microsoft.com/en-us/library/windowsazure/gg433040.aspx">Azure Storage Blobs and Queues</a> can be used to implement complex solutions that require intermediate storage between on premise and cloud processes, and the ability to orchestrate phases and operations between the two environments.</li>
</ul>

<h3><a name="Ref">References</a></h3>

<ul>
  <li><a href="https://msdn.microsoft.com/en-us/library/cc280527.aspx">Connect to an Excel Workbook</a></li>

  <li><a href="https://msdn.microsoft.com/en-us/library/ms141683.aspx">Excel Source</a> task and <a href="https://msdn.microsoft.com/en-us/library/bb895291.aspx">ADO NET Destination</a> task</li>

  <li><a href="https://www.windowsazure.com/en-us/manage/services/sql-databases/getting-started-w-sql-databases/">Getting Started with Windows Azure SQL Database</a></li>

  <li><a href="https://msdn.microsoft.com/en-us/library/ms345182.aspx">Loop through Excel Files and Tables by Using a Foreach Loop Container</a></li>

  <li><a href="https://msdn.microsoft.com/en-us/library/windowsazure/ee336275.aspx">CREATE INDEX (Windows Azure SQL Database)</a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>AdventureWorks OData sample with Named Resource Streams</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/adventureworks-odata-sample-with-named-resource-streams</link>
      <pubDate>Wed, 03 Oct 2012 19:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2012/10/03/adventureworks-odata-sample-with-named-resource-streams/</guid>
      <description><![CDATA[As a continuation of my previous blog post, the AdventureWorks QueryFeed OData sample now shows how...]]></description>
      <content:encoded><![CDATA[<p>As a continuation of my <a href="https://blogs.msdn.com/b/derrick_vanarnams_blog/archive/2012/09/12/introducing-the-odata-queryfeed-activity.aspx">previous blog post</a>, the AdventureWorks QueryFeed OData sample now shows how to implement <a href="https://msdn.microsoft.com/en-us/library/ee960144(v=VS.103).aspx">Named Resource Streams</a>&nbsp;to stream AdventureWorks product images. In addition, I added the ability to select Named Resource Streams (product images)&nbsp;within a business workflow to the QueryFeed activity, and render a stream in a Word document.</p>
<p>The AdventureWorks QueryFeed OData sample illustrates an end to end OData workflow with Office scenario. Starting with SQL Server views, the sample shows how to expose selective AdventureWorks views as an OData service. The AdventureWorks product catalog contains two product images: LargePhoto and ThumbNailPhoto. By implementing WCF Data Services 5.0 Named Resource Streams, the sample shows how to stream LargePhoto and ThumbNailPhoto into a Word document. You can select named resources in the QueryFeed workflow activity and select the default named resource that the client host will render in the TablePartPublisher workflow activity.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6283.image_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6283.image_5F00_2.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2654.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2654.image_5F00_thumb.png" width="467" height="528" /></a></p>
<p></p>
<p>By providing feedback on this blog, or sending me an email, you can help define any part of the sample. My email address is <a href="mailto:derrickv@microsoft.com">derrickv@microsoft.com</a>.</p>
<p><span style="background-color: #ffff00;"><span style="background-color: #ffffff;">The source code is available</span></span><span> at <span>CodePlex</span>.</span></p>
<ul>
<li><a href="https://msftdbprodsamples.codeplex.com/releases/view/94064">AdventureWorks OData Feed</a> (<a href="https://msftdbprodsamples.codeplex.com/releases/view/94064">https://msftdbprodsamples.codeplex.com/releases/view/94064</a>).</li>
<li><a href="https://msftdbprodsamples.codeplex.com/releases/view/94486">OData QueryFeed workflow activity</a> (<a href="https://msftdbprodsamples.codeplex.com/releases/view/94486">https://msftdbprodsamples.codeplex.com/releases/view/94486</a>).</li>
</ul>
<p>The sample shows how to integrate the following technologies to address the business scenario of consuming any OData service in an Office application. The sample uses the AdventureWorks database as an example line-of-business database with selective views exposed as OData resources.</p>
<ul>
<li>SQL Server 2008R2 or above including views with joins, ROW_NUMBER() OVER, functions, xpath queries, and configuring a NT AUTHORITY\NETWORK SERVICE login and role for IIS.</li>
<li>Windows Workflow 4.0 including custom activities, activity designers, OData schema aware expression lists, practical use of ModelItem and ModelItemTree, child activities, XML LINQ projections into entity properties, a custom workflow designer, and variables.</li>
<li>Office (Excel and Word) including hosting an OData related workflow, consuming workflow activity states using tracking participants, extension methods, embedding OData properties into Content Controls, and Open XML.</li>
</ul>
<p>The attached document explains more about the latest iteration. Also, I added a section on creating a new QueryFeed OData workflow application using the sample workflow designer.</p>
<p>The sample uses several LINQ queries to combine elements to form IEnumerable&lt;EntityProperty&gt;. I would like to use fewer LINQ queries, but ran out of time. The QueryFeed.Execute() method shows how various metadata elements are combined to form an IEnumerable&lt;EntityProperty&gt;.</p>
<h3>Named Resource Streams and product photos</h3>
<p>A data service can expose binary data. Starting with version 3 of OData, an entity can have multiple related resource streams, which are accessed by name. The sample illustrates how to implement IDataServiceStreamProvider2 to expose AdventureWorks ThumbNailPhoto and LargePhoto product images.</p>
<p>Configuring a data service to support the streaming of binary data requires five steps.</p>
<ol>
<li>Attribute the target entity that has resource streams.</li>
<li>Implement <a href="https://msdn.microsoft.com/en-us/library/system.data.services.providers.idataservicestreamprovider2(v=vs.103).aspx">IDataServiceStreamProvider2</a> &ndash; required only for named resource streams.</li>
<li>Implement <a href="https://msdn.microsoft.com/en-us/library/system.data.services.providers.idataservicestreamprovider(v=vs.103).aspx">IDataServiceStreamProvider</a> &ndash; required to support both kinds of binary resource stream.</li>
<li>Define a data service that implements the <a href="https://msdn.microsoft.com/en-us/library/system.iserviceprovider(v=vs.103).aspx">IServiceProvider</a> interface. The data service uses the <a href="https://msdn.microsoft.com/en-us/library/system.iserviceprovider.getservice(v=vs.103).aspx">GetService</a> implementation to access the streaming data provider implementation. This method returns the appropriate streaming provider implementation.</li>
<li>Enable large message streams in the Web application configuration and access to binary resources on the server or in a data source.</li>
</ol>
<p><b>Step 1 - Attribute the target entity that has resource streams.</b></p>
<p>The AdevntureWorks sample attributes vProductCatalog. See AdventureWorksModel.Extensions.cs within the code sample.</p>
<pre class="scroll"><code class="csharp">using System.Data.Services.Common;<br /> <br /> namespace Microsoft.Samples.SqlServer.AdventureWorksService<br /> {<br /> [NamedStream("LargePhoto")]<br /> [NamedStream("ThumbNailPhoto")]<br /> public partial class vProductCatalog { }<br /> }</code></pre>
<p><strong>Step 2 - Implement </strong><a href="https://msdn.microsoft.com/en-us/library/system.data.services.providers.idataservicestreamprovider2(v=vs.103).aspx"><strong>IDataServiceStreamProvider2</strong></a><strong> &ndash; required only for named resource streams.</strong></p>
<pre class="scroll"><code class="csharp">public class ProductCatalogResourceProvider : IDataServiceStreamProvider2<br /> {<br /> &hellip;<br /> <br /> public Stream GetReadStream(object entity, ResourceProperty resourceProperty, string etag, bool? checkETagForEquality, DataServiceOperationContext operationContext)<br /> {<br /> vProductCatalog image = entity as vProductCatalog;<br /> <br /> if (image == null)<br /> {<br /> throw new DataServiceException(500, "Internal Server Error.");<br /> }<br /> <br /> // Return a stream that contains the requested ThumbnailPhoto or <br /> LargePhoto<br /> <br /> return ProductPhoto(image.ProductID, resourceProperty.Name);<br /> }<br /></code></pre>
<pre class="scroll"><code class="csharp">//The sample uses .NET Framework 4.5 SqlDataReader.GetStream();<br /> private Stream ProductPhoto(int productID, string columnName)<br /> {<br /> Stream productPhoto = null;<br /> <br /> using (SqlConnection connection = new SqlConnection<br /> (Properties.Settings.Default.Setting.ToString()))<br /> {<br /> using (SqlCommand command = connection.CreateCommand())<br /> {<br /> // Setup the command<br /> command.CommandText =<br /> string.Format("SELECT {0} FROM Production.vProductCatalogImages WHERE ProductID=@ProductID", columnName);<br /> <br /> command.CommandType = CommandType.Text;<br /> <br /> // Declare the parameter<br /> SqlParameter paramID = new SqlParameter("@ProductID", SqlDbType.Int);<br /> <br /> paramID.Value = productID;<br /> command.Parameters.Add(paramID);<br /> <br /> connection.Open();<br /> <br /> try<br /> {<br /> using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))<br /> {<br /> reader.Read();<br /> if (reader.HasRows)<br /> productPhoto = reader.GetStream(0);<br /> }<br /> }<br /> catch (SqlException ex)<br /> {<br /> //Log the SqlException, such as Invalid column name, in a production application<br /> }<br /> <br /> return productPhoto;<br /> }<br /> }<br /> }<br /> </code></pre>
<p><strong>Step 3 - Implement </strong><a href="https://msdn.microsoft.com/en-us/library/system.data.services.providers.idataservicestreamprovider(v=vs.103).aspx"><strong>IDataServiceStreamProvider</strong></a><strong> &ndash; required to support both kinds of binary resource stream.</strong> The sample only implements IDataServiceStreamProvider2.GetReadStream().</p>
<p><strong>Step 4 - Define a data service that implements the </strong><a href="https://msdn.microsoft.com/en-us/library/system.iserviceprovider(v=vs.103).aspx"><strong>IServiceProvider</strong></a><strong> interface.</strong></p>
<pre class="scroll"><code class="csharp">public object GetService(Type serviceType)<br /> {<br /> if(serviceType == typeof(IDataServiceStreamProvider2))<br /> {<br /> //Return the stream provider to the data service.<br /> return new ProductCatalogResourceProvider();<br /> }<br /> <br /> return null;<br /> }<br /> </code></pre>
<p><b>Step 4 - Enable large message streams in the Web application configuration.</b></p>
<p>When you create a data service in an ASP.NET Web application, Windows Communication Foundation (WCF) is used to provide the HTTP protocol implementation. By default, WCF limits the size of HTTP messages to only 65K bytes. To stream large binary data to and from the data service, you configure the Web application to enable large binary files and to use streams for transfer. To do this, add &lt;services&gt; element and &lt;bindings&gt; element to the application's Web.config file:</p>
<pre>&lt;system.serviceModel&gt;</pre>
<pre>&nbsp; <strong>&nbsp; &lt;services&gt;</strong></pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--The name of the service--&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;service name="AdventureWorks_ODataService.AdventureWorks"&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--you can leave the address blank or specify your end point URI--&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;endpoint binding="webHttpBinding" bindingConfiguration="higherMessageSize" </pre>
<blockquote>
<pre>contract="System.Data.Services.IRequestHandler" /&gt;</pre>
</blockquote>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/service&gt;</pre>
<pre>&nbsp;&nbsp; <strong> &lt;/services&gt;</strong></pre>
<pre>&nbsp;&nbsp;&nbsp; <strong>&lt;bindings&gt;</strong></pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;webHttpBinding&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- configure the maxReceivedMessageSize value to suit the max size of </pre>
<pre>&nbsp;&nbsp; the request (in bytes) you want the service to recieve--&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;binding name="higherMessageSize" maxReceivedMessageSize="500000" /&gt;</pre>
<pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/webHttpBinding&gt;</pre>
<pre>&nbsp;&nbsp; <strong> &lt;/bindings&gt;</strong></pre>
<pre>&nbsp; &lt;/system.serviceModel&gt;</pre>
<p>See AdventureWorks.OData.Service.sln for a complete sample service. For more information, see <a href="https://msdn.microsoft.com/en-us/library/ee960144(v=VS.103).aspx">Streaming Provider (WCF Data Services)</a>.</p>
<h1>QueryFeed activity</h1>
<p>The sample QueryFeed activity now allows you to select Named Resources.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6283.image_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6283.image_5F00_4.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3250.image_thumb_1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3250.image_5F00_thumb_5F00_1.png" width="165" height="244" /></a></p>
<p>In addition, you can select a default resource to render in the TablePartPublisher activity.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5381.image_8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5381.image_5F00_8.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2260.image_thumb_3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2260.image_5F00_thumb_5F00_3.png" width="218" height="131" /></a></p>
<p>Finally, as mentioned in my previous post, the attached document details how to edit a QueryFeed workflow using a hosted Windows Workflow designer. After creating a product catalog workflow application, you can render a Word table. The images in the sample table were rendered using Named Resource Streams.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/4743.image_10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/4743.image_5F00_10.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2260.image_thumb_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2260.image_5F00_thumb_5F00_4.png" width="439" height="537" />&nbsp;</a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/35/57/45/AdventureWorks%20OData-Named%20Resource%20Streams.docx" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-35-57-45/AdventureWorks-OData_2D00_Named-Resource-Streams.docx">AdventureWorks OData-Named Resource Streams.docx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>OData QueryFeed workflow activity (Refresh)</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/odata-queryfeed-workflow-activity-refresh</link>
      <pubDate>Thu, 13 Sep 2012 21:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2012/09/13/odata-queryfeed-workflow-activity-refresh/</guid>
      <description><![CDATA[I just updated the OData QueryFeed workflow activity sample.
My original entity properties...]]></description>
      <content:encoded><![CDATA[<p>I just updated the <a href="https://msftdbprodsamples.codeplex.com/releases/view/94486">OData QueryFeed workflow activity sample</a>.</p>
<p>My original entity properties TablePartPublisherDesigner had style names hard-coded in the activity designer. This was okay to demonstrate the concept of an activity publisher. However, I wanted a way for the client hosting the workflow designer to supply style names for any TablePartPublisherDesigner.&nbsp; After some research, I decided to use the workflow designer ModelService to get an enumeration of ModelItems from the ModelItemTree. A LINQ statement returns a collection of ModelItems of type TablePartPublisher. From this collection, the ViewService.GetView(modelItem) is used to get each TablePartPublisherDesigner. Once I had each TablePartPublisherDesigner, I was able to add style names to each activity designer from within the workflow designer client.</p>
<p>With this approach, a client application can supply expression data to an activity designer.</p>
<p>The source code at <a title="https://msftdbprodsamples.codeplex.com/releases/view/94486" href="https://msftdbprodsamples.codeplex.com/releases/view/94486">https://msftdbprodsamples.codeplex.com/releases/view/94486</a> shows how this is done.</p>
<p>The result is an activity with expression items set by the client host:</p>
<table style="width: 400px;" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="200"><strong>Excel Host</strong></td>
<td valign="top" width="200"><strong>Word Host</strong></td>
</tr>
<tr>
<td valign="top" width="200"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6811.image_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6811.image_5F00_6.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/8880.image_thumb_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/8880.image_5F00_thumb_5F00_2.png" width="244" height="194" /></a></td>
<td valign="top" width="200"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/8473.image_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/8473.image_5F00_2.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6305.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6305.image_5F00_thumb.png" width="245" height="194" /></a></td>
</tr>
</tbody>
</table>
<p></p>
<h3><strong>Here is some of the code:</strong></h3>
<p>modelService = workflowDesigner.Context.Services.GetService&lt;ModelService&gt;();</p>
<p>//Set StyleNames</p>
<p>IEnumerable&lt;ModelItem&gt; activityCollection = modelService.Find(modelService.Root, typeof(Activity)) ;</p>
<p>var tablePartPublisherDesigners = from mi in activityCollection <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where mi.ItemType == typeof(Microsoft.Samples.SqlServer.Activities.ActivityPublishers.TablePartPublisher) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select mi;</p>
<p>foreach (ModelItem mi in tablePartPublisherDesigners) <br />{ <br />&nbsp;&nbsp;&nbsp; this.SetStyleNames(workflowDesigner.Context.Services.GetService&lt;ViewService&gt;().GetView(mi) as TablePartPublisherDesigner); <br />}</p>
<p>private void SetStyleNames(TablePartPublisherDesigner activityPublisher) <br />&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (this.ClientName) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case "Word": <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("Light Shading - Accent 5"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("Light Shading - Accent 2"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("Medium List 2 - Accent 5"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("Medium Grid 1 - Accent 4"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("Colorful List"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default: <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("TableStyleMedium9"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("TableStyleMedium10"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("TableStyleMedium20"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("TableStyleMedium24"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; activityPublisher.StyleNames.Add("TableStyleMedium28"); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp; }</p>]]></content:encoded>
    </item>
    <item>
      <title>Introducing the OData QueryFeed workflow activity</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/introducing-the-odata-queryfeed-workflow-activity</link>
      <pubDate>Wed, 12 Sep 2012 11:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2012/09/12/introducing-the-odata-queryfeed-workflow-activity/</guid>
      <description><![CDATA[As a continuation of my previous blog post, I created an OData QueryFeed workflow activity sample....]]></description>
      <content:encoded><![CDATA[<p>As a continuation of my <a href="https://blogs.msdn.com/b/derrick_vanarnams_blog/archive/2012/09/06/announcing-the-adventureworks-odata-feed-sample.aspx">previous blog post</a>, I created an OData QueryFeed workflow activity sample. The sample represents an end to end data movement application utilizing a number of technologies including</p>
<ul>
<li>Using LINQ to project OData entity XML to entity classes.</li>
<li>Creating custom workflow activities.</li>
<li>Creating custom workflow designers containing OData schema aware expression editors and WorkflowItemsPresenters. A WorkflowItemsPresenter is used to drop OData Filter activities that format a fully qualified OData filter parameter.</li>
<li>WPF ComboBox items hosting a button and checkbox.</li>
<li>Hosting the Windows Workflow designer within Microsoft Excel 2010.</li>
<li>Running a workflow from within a Microsoft Excel 2010 and Microsoft Word 2010 Addin.</li>
<li>Using a workflow Tracking Participant to subscribe to activity states.</li>
<li>Creating ModelItem and Office extension methods.</li>
<li>Open XML 2.0 that renders OData entity properties as a Word 2010 table.</li>
</ul>
<p>By providing feedback on this blog, or sending me an email, you can help define any part of the sample. My email address is <a href="mailto:derrickv@microsoft.com">derrickv@microsoft.com</a>.</p>
<h3>Source Code</h3>
<p><a href="https://msftdbprodsamples.codeplex.com/releases/view/94486">https://msftdbprodsamples.codeplex.com/releases/view/94486</a>.</p>
<h3>User Story</h3>
<p>The sample addresses the following user story:</p>
<p style="padding-left: 30px;">As a developer, I want to create an OData feed activity so that an IT Analyst can consume any AdventureWorks OData feed within a business workflow.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/8407.image_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/8407.image_5F00_4.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3276.image_thumb_1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3276.image_5F00_thumb_5F00_1.png" width="244" height="213" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5736.image_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5736.image_5F00_6.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2210.image_thumb_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2210.image_5F00_thumb_5F00_2.png" width="244" height="166" /></a></p>
<p>The OData <b>QueryFeed</b> sample activity shows how to create a workflow activity that consumes an OData resource, and renders entity properties in a Microsoft Excel 2010 worksheet or Microsoft Word 2010 document. Using the sample <b>QueryFeed</b> activity, you can consume any OData resource. The sample activity uses LINQ to project OData metadata into activity designer expression items. By setting activity expressions, a fully qualified OData query string is constructed consisting of Resource, Filter, OrderBy, and Select parameters. Executing the activity returns OData entity properties.</p>
<h4>Resource</h4>
<p><b>Query string part</b></p>
<p>/CompanySales</p>
<p><b>EntitySets LINQ for Resource Items</b></p>
<pre class="scroll"><code class="csharp"> public IEnumerable&lt;EntitySet&gt; EntitySets<br /> {<br /> get<br /> {<br /> //Arrange: A url to a WCF 5.0 service is given as InArgument_Url<br /> XNamespace xmlns = "https://schemas.microsoft.com/ado/2008/09/edm";<br /> <br /> //Act: A LINQ to XML query is constructed that projects EntitySet XML to an EntitySet class<br /> IEnumerable&lt;EntitySet&gt; entitySets = from x in metadata<br /> .Descendants(xmlns.GetName("EntitySet"))<br /> select new EntitySet<br /> {<br /> Name = x.Attributes("Name").Single().Value,<br /> Namespace = x.Attributes("EntityType").Single().Value.Split(new char[] { '.' })[0],<br /> EntityType = x.Attributes("EntityType").Single().Value.Split(new char[] { '.' })[1]<br /> };<br /> <br /> //Return:<br /> return entitySets;<br /> }<br /> }</code><b></b></pre>
<h4>Filter</h4>
<p><b>Query string part</b></p>
<p>$filter=OrderYear ne 2006 and Sales lt 10000</p>
<p><b>EntitySetSchema LINQ for Filter Items</b></p>
<pre class="scroll"><code class="csharp"> public IEnumerable&lt;EntityPropertySchema&gt; EntitySetSchema(string resource)<br /> {<br /> IEnumerable&lt;EntityPropertySchema&gt; entitySchema = null;<br /> if (resource != string.Empty)<br /> {<br /> XNamespace xmlns = "https://schemas.microsoft.com/ado/2008/09/edm";<br /> entitySchema = from p in metadata<br /> .Descendants(xmlns.GetName("EntityType")).Descendants(xmlns.GetName("Property"))<br /> where p.Parent.Attribute("Name").Value == (from e in this.EntitySets where e.Name == resource select e.EntityType).Single&lt;string&gt;()<br /> select new EntityPropertySchema<br /> {<br /> Parent = p.Parent,<br /> Name = p.Attribute("Name").Value,<br /> Type = p.Attribute("Type").Value,<br /> MaxLength = p.Attribute("MaxLength") == null ? "NaN" : p.Attribute("MaxLength").Value<br /> };<br /> }<br /> <br /> return entitySchema;<br /> }</code><b></b></pre>
<h4>OrderBy</h4>
<p><b>Query string part</b></p>
<p>$orderby=ProductSubCategory asc,Sales desc</p>
<p><b>EntitySetSchema LINQ for Filter Items</b></p>
<p>See Filter</p>
<h4>Select</h4>
<p><b>Query string part</b></p>
<p>$select=ProductSubCategory,Sales</p>
<p><b>EntitySetSchema LINQ for Filter Items</b></p>
<p>See Filter</p>
<h3>Rendering QueryFeed TableParts</h3>
<p>The example QueryFeed workflow renders entity properties in any client that supports .NET Framework 4.0. The sample source code at <a href="https://msftdbprodsamples.codeplex.com/releases/edit/94486">https://msftdbprodsamples.codeplex.com/releases/edit/94486</a> shows rendering an EntityProperties TablePart in Microsoft Excel 2010 and Microsoft Word 2010. The sample source code shows how to use an extension method to extend a Microsoft Excel or Microsoft Word range.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/3683.image_8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/3683.image_5F00_8.png"><img style="margin: 0px; display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/8547.image_thumb_3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/8547.image_5F00_thumb_5F00_3.png" width="244" height="205" /></a></p>
<h4><strong>Excel InsertEntityTable&nbsp;Extension Method</strong></h4>
<pre class="scroll"><code class="csharp">public static void InsertEntityTable(this Range activeCell, IEnumerable&lt;IEnumerable&lt;EntityProperty&gt;&gt; entityProperties, string styleName)<br /> {<br /> int currentColumn = 0;<br /> int currentRow = 1;<br /> Range range;<br /> <br /> List&lt;string&gt; propertyNames = (from item in entityProperties select item).First&lt;IEnumerable&lt;EntityProperty&gt;&gt;().Select(n =&gt; n.Name).ToList&lt;string&gt;();<br /> int columnCount = propertyNames.Count();<br /> int rowCount = entityProperties.Count();<br /> <br /> Globals.ThisAddIn.Application.ScreenUpdating = false;<br /> <br /> //Data Columns<br /> foreach (string name in propertyNames)<br /> {<br /> range = activeCell.get_Offset(1, currentColumn);<br /> range.FormulaR1C1 = name;<br /> currentColumn++;<br /> }<br /> currentColumn = 0;<br /> <br /> //Data Values<br /> foreach (IEnumerable&lt;EntityProperty&gt; items in entityProperties)<br /> {<br /> //row = new TableRow();<br /> currentRow++;<br /> foreach (EntityProperty item in items)<br /> {<br /> range = activeCell.get_Offset(currentRow, currentColumn);<br /> range.FormulaR1C1 = item.Value;<br /> currentColumn++;<br /> }<br /> currentColumn = 0;<br /> }<br /> <br /> Worksheet activeSheet = Globals.ThisAddIn.Application.ActiveSheet;<br /> Range styleRange = activeCell.Range[activeSheet.Cells[2, 1], activeSheet.Cells[rowCount + 2, columnCount]];<br /> string listObjectName = String.Format("Table{0}", activeSheet.ListObjects.Count);<br /> <br /> try<br /> {<br /> activeSheet.ListObjects.AddEx(XlListObjectSourceType.xlSrcRange, styleRange, Type.Missing, XlYesNoGuess.xlYes).Name = listObjectName;<br /> activeSheet.ListObjects[listObjectName].TableStyle = styleName;<br /> }<br /> catch<br /> {<br /> //Handle exception in a production application<br /> }<br /> <br /> styleRange.Columns.AutoFit();<br /> <br /> Globals.ThisAddIn.Application.ScreenUpdating = true;<br /> }</code></pre>
<p>My next post will show how to edit a QueryFeed workflow using a hosted Windows Workflow designer. A custom designer is included in the source code at <a href="https://msftdbprodsamples.codeplex.com/releases/view/94486">https://msftdbprodsamples.codeplex.com/releases/view/94486</a>.</p>
<p>You can read more about the QueryFeed workflow in the attached Introducing the OData QueryFeed Activity document.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/34/87/59/Introduction%20to%20QueryFeed%20Activity.docx" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-34-87-59/Introduction-to-QueryFeed-Activity.docx">Introduction to QueryFeed Activity.docx</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Announcing the AdventureWorks OData Feed sample</title>
      <link>https://docs.microsoft.com/archive/blogs/derrick_vanarnams_blog/announcing-the-adventureworks-odata-feed-sample</link>
      <pubDate>Wed, 05 Sep 2012 17:48:49 GMT</pubDate>
      <dc:creator><![CDATA[Derrick VanArnam [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/derrick_vanarnams_blog/2012/09/05/announcing-the-adventureworks-odata-feed-sample/</guid>
      <description><![CDATA[Overview  As a continuation of my previous blog post, we created a live AdventureWorks OData feed at...]]></description>
      <content:encoded><![CDATA[<h3>Overview</h3>  <p>As a continuation of my <a href="https://blogs.msdn.com/b/derrick_vanarnams_blog/archive/2012/08/20/adventureworks2012-odata-service-sample-iteration-1.aspx">previous blog post</a>, we created a live AdventureWorks OData feed at <a href="https://services.odata.org/AdventureWorksV3/AdventureWorks.svc">https://services.odata.org/AdventureWorksV3/AdventureWorks.svc</a>. The AdventureWorks OData service exposes resources based on specific SQL views. The SQL views are a limited subset of the AdventureWorks database that results in several consuming scenarios:</p>  <ul>   <li>CompanySales</li>    <li>Documents</li>    <li>ManufacturingInstructions</li>    <li>ProductCatalog</li>    <li>TerritorySalesDrilldown</li>    <li>WorkOrderRouting</li>  </ul>  <p>We will be iterating on this sample, so expect it to improve over time. For instance, the Documents feed currently exposes the document entity type property as an Edm.Binary type. An upcoming iteration will show how to implement <a href="https://blogs.msdn.com/b/astoriateam/archive/2010/11/12/named-resource-streams.aspx">Named Resource Streams</a> for the Documents.Document entity type property.</p>  <h3>User Story</h3>  <p>This sample iteration, on our <a href="https://msftdbprodsamples.codeplex.com/releases/view/94064">CodePlex site</a>, addresses the following user story:</p>  <blockquote>   <p>As a backend developer, I want to only allow views of the AdventureWorks2012 database to be exposed as an OData public resource so that the underlying schema can be modified without affecting the service.</p>  </blockquote>  <h3>Source Download</h3>  <ul>   <li><a href="https://msftdbprodsamples.codeplex.com/releases/view/94064">AdventureWorks OData Service</a></li>    <li><a href="https://msftdbprodsamples.codeplex.com/releases/view/93587">AdventureWorks2012 database</a></li>  </ul>  <h3>How to install the sample</h3>  <p>You can consume the AdventureWorks OData feed from <a href="https://services.odata.org/AdventureWorksV3/AdventureWorks.svc">https://services.odata.org/AdventureWorksV3/AdventureWorks.svc</a>. You can also consume the AdventureWorks OData feed by running the sample service from a local ASP.NET Development Server.</p>  <p><b>To run the service on a local ASP.NET Development Server</b></p>  <ol>   <li>Download the sample from CodePlex.</li>    <li>Attach the AdventureWorks2012 database. The AdventureWorks2012 database can be downloaded from https://msftdbprodsamples.codeplex.com/releases/view/93587</li>    <li>From Microsoft SQL Server Management Studio, run \AdventureWorks.OData.Service\SQL Scripts\Views.sql to create the OData feed SQL views.</li>    <li>Open \AdventureWorks.OData.Service\AdventureWorks.OData.Service.sln in Visual Studio 2012.</li>    <li>In Solution Explorer, select AdventureWorks.svc.</li>    <li>Press F5 to run the service on <a href="https://localhost:1234/AdventureWorks.svc/">https://localhost:1234/AdventureWorks.svc/</a>.</li>  </ol>  <p><b>AdventureWorks OData Service Resources</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/4113.image_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/4113.image_5F00_2.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6735.image_thumb.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6735.image_5F00_thumb.png" width="727" height="426" /></a></p>  <p><b>Iteration 2 will address the following user story:</b></p>  <blockquote>   <p>As a frontend developer, I want to consume the AdventureWorks OData feed so that I can use entity data within a business workflow.<b></b></p> </blockquote>  <p>The sample will show how to create a QueryFeed workflow activity that can consume any OData feed url and return an enumeration of entity properties. The sample further shows how to create an EntityProperties activity which allows a user designing a workflow to drop a TablePartPublisher into the activity. A TablePartPublisher can be consumed by any client to render entity properties. For example, a Word Add-in can consume EntityProperties and a TablePartPublisher to render an Open XML table. Iteration 2 will show how this is done.</p>  <p>I have most of the code for iteration 2 complete, but not quite ready to publish. I plan to publish iteration 2 in about two weeks. For now, I’ll show you a sample of each AdventureWorks OData resource. Each example table was created by running the custom activities from within Word.</p>  <p>My next blog post will dive into how to create OData workflow activates. Custom activity designers that consume OData metadata and use LINQ to project entity xml into entity classes will be discussed. The metadata entity classes are used to provide expression editor items.</p>  <p><b>CompanySales Example</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/7380.image_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/7380.image_5F00_4.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/7608.image_thumb_1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/7608.image_5F00_thumb_5F00_1.png" width="282" height="323" /></a></p>  <p><b>QueryFeed Url</b></p>  <p>https://localhost:1234/AdventureWorks.svc/CompanySales?$top=2&amp;$orderby=OrderYear asc</p>  <p><b>Result</b></p>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top">         <p><b>ProductCategory</b></p>       </td>        <td valign="top">         <p><b>ProductSubCategory</b></p>       </td>        <td valign="top">         <p><b>OrderYear</b></p>       </td>        <td valign="top">         <p><b>OrderQtr</b></p>       </td>        <td valign="top">         <p><b>Sales</b></p>       </td>     </tr>      <tr>       <td valign="top">         <p>Accessories</p>       </td>        <td valign="top">         <p>Bike Racks</p>       </td>        <td valign="top">         <p>2007</p>       </td>        <td valign="top">         <p>Q4</p>       </td>        <td valign="top">         <p>60883.2000</p>       </td>     </tr>      <tr>       <td valign="top">         <p>Accessories</p>       </td>        <td valign="top">         <p>Bike Racks</p>       </td>        <td valign="top">         <p>2007</p>       </td>        <td valign="top">         <p>Q3</p>       </td>        <td valign="top">         <p>75920.4000</p>       </td>     </tr>   </tbody></table>&#160;&#160; <p><b>ManufacturingInstructions Example</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/5224.image_6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/5224.image_5F00_6.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/7776.image_thumb_2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/7776.image_5F00_thumb_5F00_2.png" width="276" height="269" /></a></p>  <p><b>QueryFeed Url</b></p>  <p>https://localhost:1234/AdventureWorks.svc/ManufacturingInstructions?$top=2&amp;$select=ProductName,Instructions,SetupHours</p>  <p><b>Result</b></p>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top">         <p><b>ProductName</b></p>       </td>        <td valign="top">         <p><b>Instructions</b></p>       </td>        <td valign="top">         <p><b>SetupHours</b></p>       </td>     </tr>      <tr>       <td valign="top">         <p>HL Touring Frame</p>       </td>        <td valign="top">         <p>Adventure Works CyclesFR-210B Instructions for Manufacturing HL Touring Frame. Summary: This document contains manufacturing instructions for manufacturing the HL Touring Frame, Product Model 7. Instructions are work center specific and are identified by Work Center ID. These instructions must be followed in the order presented. Deviation from the instructions is not permitted unless an authorized Change Order detailing the deviation is provided by the Engineering Manager.</p>       </td>        <td valign="top">         <p>0.5000</p>       </td>     </tr>      <tr>       <td valign="top">         <p>HL Touring Frame</p>       </td>        <td valign="top">         <p>Adventure Works CyclesFR-210B Instructions for Manufacturing HL Touring Frame. Summary: This document contains manufacturing instructions for manufacturing the HL Touring Frame, Product Model 7. Instructions are work center specific and are identified by Work Center ID. These instructions must be followed in the order presented. Deviation from the instructions is not permitted unless an authorized Change Order detailing the deviation is provided by the Engineering Manager.</p>       </td>        <td valign="top">         <p>0.5000</p>       </td>     </tr>   </tbody></table>  <p><b>ProductCatalog Example</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1411.image_8.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1411.image_5F00_8.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6607.image_thumb_3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6607.image_5F00_thumb_5F00_3.png" width="290" height="413" /></a></p>  <p><b>QueryFeed Url</b></p>  <p>https://localhost:1234/AdventureWorks.svc/ProductCatalog?$filter=CultureID eq 'en' and ProductSubcategory eq 'Pedals'&amp;$top=2&amp;$select=ProductName,ProductSubcategory,Description,ListPrice</p>  <p><b>Results</b></p>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top">         <p><b>ProductName</b></p>       </td>        <td valign="top">         <p><b>ProductSubcategory</b></p>       </td>        <td valign="top">         <p><b>Description</b></p>       </td>        <td valign="top">         <p><b>ListPrice</b></p>       </td>     </tr>      <tr>       <td valign="top">         <p>Touring Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>A stable pedal for all-day riding.</p>       </td>        <td valign="top">         <p>80.9900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>LL Road Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Clipless pedals - aluminum.</p>       </td>        <td valign="top">         <p>40.4900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>LL Mountain Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Expanded platform so you can ride in any shoes; great for all-around riding.</p>       </td>        <td valign="top">         <p>40.4900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>ML Road Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Lightweight aluminum alloy construction.</p>       </td>        <td valign="top">         <p>62.0900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>ML Mountain Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Lightweight, durable, clipless pedal with adjustable tension.</p>       </td>        <td valign="top">         <p>62.0900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>HL Mountain Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Stainless steel; designed to shed mud easily.</p>       </td>        <td valign="top">         <p>80.9900</p>       </td>     </tr>      <tr>       <td valign="top">         <p>HL Road Pedal</p>       </td>        <td valign="top">         <p>Pedals</p>       </td>        <td valign="top">         <p>Top-of-the-line clipless pedals with adjustable tension.</p>       </td>        <td valign="top">         <p>80.9900</p>       </td>     </tr>   </tbody></table>  <p><b>TerritorySalesDrilldown Example</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6278.image_10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6278.image_5F00_10.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/6675.image_thumb_4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/6675.image_5F00_thumb_5F00_4.png" width="291" height="340" /></a></p>  <p><b>QueryFeed Url</b></p>  <p>https://localhost:1234/AdventureWorks.svc/TerritorySalesDrilldown?$filter=SalesPersonID eq 275&amp;$top=2</p>  <p><b>Result</b></p>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top">         <p><b>TerritoryName</b></p>       </td>        <td valign="top">         <p><b>SalesPersonID</b></p>       </td>        <td valign="top">         <p><b>EmployeeFirstName</b></p>       </td>        <td valign="top">         <p><b>EmployeeLastName</b></p>       </td>        <td valign="top">         <p><b>SalesOrderNumber</b></p>       </td>        <td valign="top" width="122">         <p><b>Total</b></p>       </td>     </tr>      <tr>       <td valign="top">         <p>Northeast</p>       </td>        <td valign="top">         <p>275</p>       </td>        <td valign="top">         <p>Michael</p>       </td>        <td valign="top">         <p>Blythe</p>       </td>        <td valign="top">         <p>SO43670</p>       </td>        <td valign="top" width="122">         <p>6893.2549</p>       </td>     </tr>      <tr>       <td valign="top">         <p>Northeast</p>       </td>        <td valign="top">         <p>275</p>       </td>        <td valign="top">         <p>Michael</p>       </td>        <td valign="top">         <p>Blythe</p>       </td>        <td valign="top">         <p>SO43673</p>       </td>        <td valign="top" width="122">         <p>4216.0258</p>       </td>     </tr>   </tbody></table>&#160;&#160; <p><b>WorkOrderRouting Example</b></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/2072.image_12.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/2072.image_5F00_12.png"><img style="display: inline; background-image: none;" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/52/63/metablogapi/1488.image_thumb_5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-52-63-metablogapi/1488.image_5F00_thumb_5F00_5.png" width="283" height="452" /></a></p>  <p><b>QueryFeed Url</b></p>  <p>https://localhost:1234/AdventureWorks.svc/WorkOrderRouting?$top=2&amp;$select=WorkOrderID,ProductNumber,ProductName,ScheduledStartDate,ActualStartDate,ScheduledEndDate,ActualEndDate</p>  <p><b>Result</b></p>  <table border="1" cellspacing="0" cellpadding="0"><tbody>     <tr>       <td valign="top">         <p><b>WorkOrderID</b></p>       </td>        <td valign="top">         <p><b>ProductName</b></p>       </td>        <td valign="top">         <p><b>ScheduledStartDate</b></p>       </td>        <td valign="top">         <p><b>ActualStartDate</b></p>       </td>     </tr>      <tr>       <td valign="top">         <p>36651</p>       </td>        <td valign="top">         <p>LL Mountain Seat Assembly</p>       </td>        <td valign="top">         <p>2007-07-04T00:00:00</p>       </td>        <td valign="top">         <p>2007-07-04T00:00:00</p>       </td>     </tr>      <tr>       <td valign="top">         <p>36651</p>       </td>        <td valign="top">         <p>LL Mountain Seat Assembly</p>       </td>        <td valign="top">         <p>2007-07-04T00:00:00</p>       </td>        <td valign="top">         <p>2007-07-04T00:00:00</p>       </td>     </tr>   </tbody></table>]]></content:encoded>
    </item>
  </channel>
</rss>