<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Beth Massi - Sharing the goodness that is VB : SharePoint</title><link>http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx</link><description>Tags: SharePoint</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Setting up Windows 7 for Office &amp; SharePoint 2010 Beta Development</title><link>http://blogs.msdn.com/bethmassi/archive/2009/12/02/setting-up-windows-7-for-office-sharepoint-2010-beta-development.aspx</link><pubDate>Thu, 03 Dec 2009 03:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9931766</guid><dc:creator>Beth Massi</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9931766.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9931766</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9931766</wfw:comment><description>&lt;P&gt;So I decided to get my Windows 7 laptop installed with all the latest public Betas this week which includes Visual Studio Beta 2, SharePoint 2010 Beta and Office 2010 Beta. I had been using internal builds and thought it would be better to get in sync with everyone else in the community. I have to say there were a couple bumps that I experienced along the way that had me scratching my head and searching the web so I thought I’d consolidate all the resources I found and document the steps I did which resulted in a successful install. There is a lot of information out there depending on how you want to configure your system and I’m definitely not going to cover all the possibilities, I’m just going to focus on setting up a Windows 7 development environment and what worked for me in hopes of saving some time for other folks out there. &lt;STRONG&gt;As always, your mileage may vary.&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;NOTE: If you don’t plan on doing any SharePoint development then the install of Visual Studio and Office 2010 should be very smooth. I only experienced issues installing SharePoint 2010 Beta on my Windows 7 development machine. Also be aware that SharePoint 2010 Beta is supported on Windows 7 (and Vista) only for development purposes. So you will still need to have a testing environment built on Windows 2008 Server (or R2). For more information please see, &lt;A href="http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx"&gt;Setting Up the Development Environment for SharePoint Server&lt;/A&gt; , &lt;A href="http://technet.microsoft.com/en-us/library/cc262957(office.14).aspx" target=_blank mce_href="http://technet.microsoft.com/en-us/library/cc262957(office.14).aspx"&gt;SharePoint Deployment&lt;/A&gt;, &lt;A href="http://technet.microsoft.com/en-us/library/cc262485(office.14).aspx" target=_blank mce_href="http://technet.microsoft.com/en-us/library/cc262485(office.14).aspx"&gt;Determine hardware and software requirements&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/sharepointdeveloperdocs/archive/2009/11/20/sharepoint-2010-beta-release-known-issues.aspx" target=_blank mce_href="http://blogs.msdn.com/sharepointdeveloperdocs/archive/2009/11/20/sharepoint-2010-beta-release-known-issues.aspx"&gt;SharePoint 2010 Beta Release Known Issues&lt;/A&gt;.&lt;/EM&gt;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;OS Requirements &amp;amp; Boot From VHD&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Before you attempt to set up a Windows 7 development environment, I &lt;STRONG&gt;highly &lt;/STRONG&gt;recommend booting from VHD. Do yourself a favor and create a Windows 7 bootable VHD so that if you mess up any part of an install you can simply delete it/roll back and start over. There’s a lot of information out there on how to do this but &lt;A href="http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx" target=_blank mce_href="http://blogs.technet.com/aviraj/archive/2009/01/18/windows-7-boot-from-vhd-first-impression-part-2.aspx"&gt;I used these instructions to create a Win7 64-bit VHD&lt;/A&gt; via Hyper-V, sysprep-ed it, copied it to my local hard drive, and then used BCDEdit to add the VHD to my boot menu. &lt;/P&gt;
&lt;P&gt;Make sure you create a 64-bit Windows 7 Professional or higher edition with at least 4GB RAM if you’re going to do SharePoint development. You'll need Windows 7 Enterprise or Ultimate to boot from VHD.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;What to Install - SharePoint Foundation or SharePoint Server?&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;There are two versions of SharePoint that you can choose to install. It’s recommend that you install SharePoint Foundation (formerly known as WSS) if you only have 4 GB of RAM on your machine because there’s a lot less services running than the Server version (formerly known as MOSS). But if you need all the functionality of SharePoint Server then make sure you have enough of RAM. Just for fun I installed the Server version on my machine with only 4GB and it’s maxed out at 95% so I went with Foundation in the end. :-) &lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=906c9f5a-6505-4eba-bf24-95e423ac1703&amp;amp;displaylang=en" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=906c9f5a-6505-4eba-bf24-95e423ac1703&amp;amp;displaylang=en"&gt;Download Microsoft SharePoint Foundation 2010 Beta here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=77c30c6c-47fc-416d-88e7-8122534b3f37" target=_blank mce_href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=77c30c6c-47fc-416d-88e7-8122534b3f37"&gt;Download Microsoft SharePoint Server 2010 Beta here.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Note that you do not need to register or obtain a product key for installing SharePoint Foundation but you do for Server. The Product Key for Server is located at the bottom of the download page after you register (I missed it the first time so make sure you grab that before installing). &lt;/P&gt;
&lt;H4&gt;&lt;IMG style="DISPLAY: inline; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px" align=left src="http://i.msdn.microsoft.com/ee402630.Sharepoint_lg(en-us,MSDN.10).png" mce_src="http://i.msdn.microsoft.com/ee402630.Sharepoint_lg(en-us,MSDN.10).png"&gt; &lt;BR&gt;Installing SharePoint 2010 Beta on Windows 7&lt;/H4&gt;
&lt;P&gt;&lt;BR&gt;Read these instructions carefully: &lt;A href="http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx"&gt;Setting Up the Development Environment for SharePoint Server&lt;/A&gt;&lt;STRONG&gt;&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;These are the instructions you’ll need to follow with a few additions I’ve added below as you go. Now that you’ve got your 64-bit Windows 7 VHD (are logged in as an administrator account) and downloaded SharePoint 2010 Beta you’re ready to proceed to Step 2 in the instructions. &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Step 2: Install the Prerequisites for SharePoint 2010&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;There are a lot of prerequisites that you’ll need to install before you get to actually installing the SharePoint Beta. Follow all the instructions in Step 2 exactly as it says for Windows 7 to install all the prereqs and Windows features. But note that figure 3 in bullet #9 is incorrect. WCF Non-HTTP Activation should appear as checked. The script in bullet #8 is correct, it’s just a problem with the screenshot so don’t get confused. &lt;/P&gt;
&lt;P&gt;Next reboot. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;BEFORE &lt;/STRONG&gt;going to Step 3, you will need to install a WCF hotfix &lt;A href="http://blogs.msdn.com/sharepointdeveloperdocs/archive/2009/11/20/sharepoint-2010-beta-release-known-issues.aspx" target=_blank mce_href="http://blogs.msdn.com/sharepointdeveloperdocs/archive/2009/11/20/sharepoint-2010-beta-release-known-issues.aspx"&gt;as described in this post&lt;/A&gt; which fixes an "Unrecognized attribute 'allowInsecureTransport'" error. The WCF &lt;A href="http://go.microsoft.com/fwlink/?LinkID=166231" target=_blank mce_href="http://go.microsoft.com/fwlink/?LinkID=166231"&gt;hotfix for Windows 7 is available here&lt;/A&gt;. After installing this hotfix, reboot.&lt;/P&gt;
&lt;P&gt;Now you’re at Step 3 and ready to install SharePoint. &lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Step 3: Install SharePoint 2010&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Follow the instructions listed in this step to install SharePoint until you get to bullet #5. When you get here, you need to download and install the &lt;A href="http://support.microsoft.com/kb/970315" target=_blank mce_href="http://support.microsoft.com/kb/970315"&gt;SQL Server 2008 KB 970315 x64&lt;/A&gt; hotfix SQL_Server_2008_SP1_Cumulative_Update_2 build &lt;BR&gt;10.00.2714.00 which you get to by clicking the &lt;A href="http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=970315&amp;amp;kbln=en-us" target=_blank mce_href="http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=970315&amp;amp;kbln=en-us"&gt;View and request hotfix downloads&lt;/A&gt;&lt;EM&gt;&lt;/EM&gt; link at the top of the KB article. &lt;/P&gt;
&lt;P&gt;When installing this though I got the error "Invoke or BeginInvoke cannot be called on a control until the window handle has been created." To resolve it, I closed the all open windows including the SharePoint Configuration wizard (which is sitting open after SharePoint is installed) and then I reran the hotfix. Not sure what is going on here but it looks like it’s a &lt;A href="http://blogs.msdn.com/petersad/archive/2009/08/14/invoke-or-begininvoke-cannot-be-called-on-a-control-until-the-window-handle-has-been-created.aspx" target=_blank mce_href="http://blogs.msdn.com/petersad/archive/2009/08/14/invoke-or-begininvoke-cannot-be-called-on-a-control-until-the-window-handle-has-been-created.aspx"&gt;known issue on Win 7 64 according to this post&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;After that successfully installed I rebooted again. &lt;/P&gt;
&lt;P&gt;Now you need to run the SharePoint Configuration wizard, Start –&amp;gt; Programs –&amp;gt; Microsoft SharePoint 2010 Products –&amp;gt; SharePoint 2010 Products Configuration. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note to domain users:&lt;/STRONG&gt; If you are installing as an administrator but your account is part of a domain, you will need to make sure you have online access to the domain controller! Otherwise configuration will fail on Step 2 with “Exception: Microsoft.SharePoint.SPException: User cannot be found.” This happens even though you select to install the standalone version. This bit me because I was installing on a laptop at home and was not on the corporate domain. I had to start my VPN and then I was good to go, until step 5 that is. ;-) &lt;/P&gt;
&lt;P&gt;On Step 5 I ran into another error “Failed to register SharePoint services. An exception of type System.ServiceProcess.TimeoutException was thrown.” This happened when I was installing the Server version and not Foundation. However &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/d5bc40dc-88cf-42b5-8a6c-120e5a8e1dc4" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/d5bc40dc-88cf-42b5-8a6c-120e5a8e1dc4"&gt;I found a thread&lt;/A&gt; that told me this is related to low memory so I closed some other programs I had running and tried it again and it ran fine. This is why you should make sure you have enough memory before starting. ;-)&lt;/P&gt;
&lt;P&gt;You made it! SharePoint 2010 Beta should now be installed. To verify, open your browser to http://&lt;EM&gt;&amp;lt;MachineName&amp;gt; &lt;/EM&gt;and you should be able to start playing with your new SharePoint site. &lt;STRONG&gt;&lt;IMG style="MARGIN: 0px 10px 0px 0px; DISPLAY: inline" align=left src="http://i.msdn.microsoft.com/ee402630.VisualStudio_lg(en-us,MSDN.10).png" mce_src="http://i.msdn.microsoft.com/ee402630.VisualStudio_lg(en-us,MSDN.10).png"&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H4&gt;Installing Visual Studio 2010 Beta 2&lt;/H4&gt;
&lt;P&gt;&lt;BR&gt;Everything should be super easy to install now but just in case you may want to save your VHD after you get SharePoint successfully installed ;-). &lt;/P&gt;
&lt;P&gt;You’ll need Visual Studio 2010 Beta Professional edition or higher to work with Office &amp;amp; SharePoint. I just picked the whole she-bang, Visual Studio 2010 Ultimate. I used the web installer but you can also choose the ISO package if you want to bring it all down once. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://go.microsoft.com/fwlink/?LinkID=165573" target=_blank mce_href="http://go.microsoft.com/fwlink/?LinkID=165573"&gt;Download Visual Studio 2010 Ultimate (web bootstrapper)&lt;/A&gt; (See &lt;A href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;this page for more&lt;/A&gt; download options).&lt;/P&gt;
&lt;P&gt;There was no hitch to install all the components of Visual Studio 2010 and .NET Framework 4. It took me about 35 minutes to wait for it to complete with one reboot in the middle. For more information, see the &lt;A href="http://go.microsoft.com/fwlink/?LinkID=166199" target=_blank mce_href="http://go.microsoft.com/fwlink/?LinkID=166199"&gt;Visual Studio 2010 Beta 2 Readme&lt;/A&gt;, &lt;A href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target=_blank mce_href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;Visual Studio 2010 Product Information&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx"&gt;Featured Overviews and Walkthroughs&lt;/A&gt;.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;IMG style="MARGIN: 0px; DISPLAY: inline" align=left src="http://i.msdn.microsoft.com/ee402630.Office2010_lg(en-us,MSDN.10).png" mce_src="http://i.msdn.microsoft.com/ee402630.Office2010_lg(en-us,MSDN.10).png"&gt;&amp;nbsp; &lt;BR&gt;&lt;/STRONG&gt;Installing Microsoft Office 2010 Beta&lt;/H4&gt;
&lt;P&gt;&lt;BR&gt;This one is probably the easiest to install. &lt;/P&gt;
&lt;P&gt;&lt;A title=http://msdn.microsoft.com/en-us/evalcenter/ee390822.aspx href="http://msdn.microsoft.com/en-us/evalcenter/ee390822.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/evalcenter/ee390822.aspx"&gt;Download Office 2010 Beta here.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Scroll to the bottom of the page to get started. You’ll need to register and then you’ll get a product key page with a download button at the bottom. Save your product key and then select the language to download. Note that it says “&lt;EM&gt;Download the 32-bit (x86) version:&lt;/EM&gt;” but the download will include both 32-bit and 64-bit so don’t worry. &lt;/P&gt;
&lt;P&gt;Once you click the download button you’ll actually have to install a little download manager to get the setup package. Once you download the package, click on the ProfessionalPlus.exe to start the install. You’ll see a big button “Install Now”. Click that and in about 15 minutes you’ll have Office installed. It doesn’t get much easier than that.&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;Let ‘er Rip!&lt;A href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/SettingupWindows7forOfficeSharePoint2010_CA0B/spsite_4.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/SettingupWindows7forOfficeSharePoint2010_CA0B/spsite_4.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; MARGIN: 0px 0px 0px 10px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title=spsite border=0 alt=spsite align=right src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/SettingupWindows7forOfficeSharePoint2010_CA0B/spsite_thumb_1.png" width=341 height=362 mce_src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/SettingupWindows7forOfficeSharePoint2010_CA0B/spsite_thumb_1.png"&gt;&lt;/A&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Okay so you want to be able to test these things are all installed and playing happily. In order to develop against SharePoint you’ll need to open Visual Studio as &lt;STRONG&gt;run as Administrator. &lt;/STRONG&gt;Next, open the Server Explorer and you should see a SharePoint Connections node. Expand that node and you should be able to browse your SharePoint site.&lt;/P&gt;
&lt;P&gt;You should also explore some of the awesome new project templates under the Office &amp;gt; 2010 and SharePoint &amp;gt; 2010 nodes in the File &amp;gt; New Project dialog. &lt;/P&gt;
&lt;H4&gt;What’s Next?&lt;/H4&gt;
&lt;P&gt;Now it’s time for us to learn how to use these Office and SharePoint tools in Visual Studio! Check out some of my favorite resources:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Office 2010 Development Resources&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/vsto/ee676911.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vsto/ee676911.aspx"&gt;Office Development in Visual Studio 2010 Beta Samples, Walkthroughs and Videos&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/officedevelopmentprerelease/threads" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/officedevelopmentprerelease/threads"&gt;Office Development in Visual Studio 2010 Forums&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/vsto/default.aspx" target=_blank mce_href="http://blogs.msdn.com/vsto/default.aspx"&gt;Office Development with Visual Studio Team Blog&lt;/A&gt;&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/office/ee513173.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/office/ee513173.aspx"&gt;Office 2010 Beta Resources&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.technet.com/gray_knowlton/archive/2009/11/10/office-2010-application-compatibility-deep-dive-on-the-code-compatibility-inspector.aspx" target=_blank mce_href="http://blogs.technet.com/gray_knowlton/archive/2009/11/10/office-2010-application-compatibility-deep-dive-on-the-code-compatibility-inspector.aspx"&gt;Office 2010 Application Compatibility Tools&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;SharePoint 2010 Development Resources&lt;/STRONG&gt;&lt;/P&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint" target=_blank mce_href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/tags/Sharepoint+2010+Beta/" target=_blank mce_href="http://channel9.msdn.com/tags/Sharepoint+2010+Beta/"&gt;SharePoint Development in Visual Studio 2010 Videos&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads" target=_blank mce_href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads"&gt;SharePoint Development Forums&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx"&gt;SharePoint 2010 Development Resources&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/sharepoint/" target=_blank mce_href="http://blogs.msdn.com/sharepoint/"&gt;SharePoint Team Blog&lt;/A&gt; 
&lt;P&gt;Enjoy!&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9931766" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Article/default.aspx">Article</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Office/default.aspx">Office</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Windows+7/default.aspx">Windows 7</category></item><item><title>Channel 9 Interview: Implementing a Silverlight SharePoint WebPart with Visual Studio 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/11/25/channel-9-interview-implementing-a-silverlight-sharepoint-webpart-with-visual-studio-2010.aspx</link><pubDate>Wed, 25 Nov 2009 17:37:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9928676</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9928676.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9928676</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9928676</wfw:comment><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Implementing-a-Silverlight-SharePoint-WebPart-with-Visual-Studio-2010/" target="_blank"&gt;Mike Morton is back at it again&lt;/a&gt;, this time showing how easy it is to develop, package and deploy a Silverlight WebPart to SharePoint 2010. He also walks us through the solution, package and file properties available to you in Visual Studio 2010. You'll see me giggling in this one because I can't believe how easy it is. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Channel 9 Interview: &lt;/strong&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Implementing-a-Silverlight-SharePoint-WebPart-with-Visual-Studio-2010/"&gt;&lt;strong&gt;Implementing a Silverlight SharePoint WebPart with Visual Studio 2010&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For more information on SharePoint Development in Visual Studio 2010 please see:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;SharePoint Development in Visual Studio 2010 Samples&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx"&gt;SharePoint 2010 Development Resources&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepoint"&gt;SharePoint Team Blog&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto"&gt;Office Development in Visual Studio Team Blog&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Also if you missed them, check out these interviews as well:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/"&gt;Overview of SharePoint Development in Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Importing-SharePoint-Solution-Packages-WSP-into-Visual-Studio-2010/"&gt;Importing SharePoint Solution Packages (WSP) into Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/SharePoint-Feature-and-Package-Designers-in-Visual-Studio-2010/"&gt;SharePoint Feature and Package Designers in Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Using-the-SharePoint-Business-Data-Connectivity-Designer-in-VS-2010/"&gt;Using the SharePoint Business Data Connectivity Designer in VS 2010 &lt;/a&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Using-the-SharePoint-Business-Data-Connectivity-Designer-in-VS-2010/"&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And &lt;b&gt;please&lt;/b&gt; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads"&gt;give us your feedback in the SharePoint Development Forums&lt;/a&gt;! &lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9928676" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Channel9/default.aspx">Channel9</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category></item><item><title>Channel 9 Interview: Using the SharePoint Business Data Connectivity Designer in VS 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/11/23/channel-9-interview-using-the-sharepoint-business-data-connectivity-designer-in-vs-2010.aspx</link><pubDate>Mon, 23 Nov 2009 17:33:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9927399</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9927399.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9927399</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9927399</wfw:comment><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Using-the-SharePoint-Business-Data-Connectivity-Designer-in-VS-2010/" target="_blank"&gt;This time I interview a good friend of mine&lt;/a&gt;, Boris Scholl, a Program Manager on the Visual Studio Team building tools for SharePoint development. Boris shows off the new Business Data Connectivity designer in Visual Studio 2010 and how it allows you to describe data coming from multiple data sources and how to work with them in SharePoint. He builds a master/detail association across entities coming from separate data sources (a database and a service) and demonstrates how the entities can be displayed and edited. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Channel 9 Interview: &lt;/strong&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Using-the-SharePoint-Business-Data-Connectivity-Designer-in-VS-2010/"&gt;&lt;strong&gt;Using the SharePoint Business Data Connectivity Designer in Visual Studio 2010 &lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;For more information on SharePoint Development in Visual Studio 2010 please see:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint" target="_blank"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010" target="_blank"&gt;SharePoint Development in Visual Studio 2010 Samples&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx" target="_blank"&gt;SharePoint 2010 Development Resources&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepoint" target="_blank"&gt;SharePoint Team Blog&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto" target="_blank"&gt;Office Development in Visual Studio Team Blog&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Also if you missed them, check out these interviews as well:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;b&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/" target="_blank"&gt;Overview of SharePoint Development in Visual Studio 2010&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Importing-SharePoint-Solution-Packages-WSP-into-Visual-Studio-2010/" target="_blank"&gt;Importing SharePoint Solution Packages (WSP) into Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/SharePoint-Feature-and-Package-Designers-in-Visual-Studio-2010/"&gt;SharePoint Feature and Package Designers in Visual Studio 2010&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And &lt;b&gt;please&lt;/b&gt; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads" target="_blank"&gt;give us your feedback in the SharePoint Development Forums&lt;/a&gt;!     &lt;br /&gt;    &lt;br /&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9927399" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Channel9/default.aspx">Channel9</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category></item><item><title>Channel 9 Interview: SharePoint Feature and Package Designers in Visual Studio 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/11/19/channel-9-interview-sharepoint-feature-and-package-designers-in-visual-studio-2010.aspx</link><pubDate>Thu, 19 Nov 2009 18:21:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9925637</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9925637.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9925637</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9925637</wfw:comment><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/SharePoint-Feature-and-Package-Designers-in-Visual-Studio-2010/" target="_blank"&gt;In this interview&lt;/a&gt; I sit down with Lily Ma, a Program Manager on the Visual Studio Team building tools for SharePoint development. Lily shows off the new SharePoint feature and package designers in Visual Studio 2010 and how they make packaging up and deploying your SharePoint customizations easy. As she dives deeper into the tools, she also demonstrates the flexibility and control you have in specifying what features go in what packages across projects in your solution as well as how to modify the manifests to meet a variety of developer needs. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Channel 9 Interview: &lt;/strong&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/SharePoint-Feature-and-Package-Designers-in-Visual-Studio-2010/" target="_blank"&gt;&lt;strong&gt;SharePoint Feature and Package Designers in Visual Studio 2010&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also if you missed it, check out these interviews as well:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/" target="_blank"&gt;Overview of SharePoint Development in Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Importing-SharePoint-Solution-Packages-WSP-into-Visual-Studio-2010/" target="_blank"&gt;Importing SharePoint Solution Packages (WSP) into Visual Studio 2010&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For more information on SharePoint Development in Visual Studio 2010 please see:&lt;/p&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint" target="_blank"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs&lt;/a&gt; &lt;a href="http:///"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010" target="_blank"&gt;SharePoint Development in Visual Studio 2010 Samples&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx" target="_blank"&gt;SharePoint 2010 Development Resources&lt;/a&gt;&amp;#160;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepoint" target="_blank"&gt;SharePoint Team Blog&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto" target="_blank"&gt;Office Development in Visual Studio Team Blog&lt;/a&gt;    &lt;p&gt;And &lt;b&gt;please&lt;/b&gt; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads" target="_blank"&gt;give us your feedback in the SharePoint Development Forums&lt;/a&gt;! &lt;/p&gt;    &lt;p&gt;Enjoy!&lt;/p&gt; &lt;/li&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9925637" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Channel9/default.aspx">Channel9</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category></item><item><title>Channel 9 Interview: Importing SharePoint Solution Packages (WSP) into Visual Studio 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/11/18/channel-9-interview-importing-sharepoint-solution-packages-wsp-into-visual-studio-2010.aspx</link><pubDate>Wed, 18 Nov 2009 20:47:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9924682</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9924682.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9924682</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9924682</wfw:comment><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Importing-SharePoint-Solution-Packages-WSP-into-Visual-Studio-2010/" target="_blank"&gt;In this interview&lt;/a&gt; I sit down with Saaid Khan, a Program Manager on the Visual Studio team developing tools for SharePoint development. Saaid shows us the WSP Import Wizard in Visual Studio 2010 that allows developers to take SharePoint Solution packages developed with SharePoint Designer and bring them into Visual Studio 2010 to further customize them there. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Channel 9 Interview: &lt;/strong&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Importing-SharePoint-Solution-Packages-WSP-into-Visual-Studio-2010/"&gt;&lt;strong&gt;Importing SharePoint Solution Packages (WSP) into Visual Studio 2010&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also if you missed it, check out &lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/"&gt;Overview of SharePoint Development in Visual Studio 2010&lt;/a&gt; which I posted on Monday.&lt;/p&gt;  &lt;p&gt;For more information on SharePoint Development in Visual Studio 2010 please see:&lt;/p&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx"&gt;SharePoint 2010 Development Resources &lt;/a&gt;&lt;a href="http:///"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs &lt;/a&gt;&lt;a href="http:///"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;SharePoint Development in Visual Studio 2010 Samples&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepoint"&gt;SharePoint Team Blog&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto"&gt;Office Development in Visual Studio Team Blog&lt;/a&gt;    &lt;p&gt;And &lt;b&gt;please&lt;/b&gt; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads"&gt;give us your feedback in the SharePoint Development Forums&lt;/a&gt;! &lt;/p&gt;    &lt;p&gt;Enjoy!&lt;/p&gt; &lt;/li&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9924682" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Channel9/default.aspx">Channel9</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category></item><item><title>Channel 9 Interview: Overview of SharePoint Development in Visual Studio 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/11/16/channel-9-interview-overview-of-sharepoint-development-in-visual-studio-2010.aspx</link><pubDate>Mon, 16 Nov 2009 23:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9923265</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9923265.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9923265</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9923265</wfw:comment><description>&lt;p&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/" target="_blank"&gt;In this interview&lt;/a&gt; I catch up with Mike Morton, a Senior Program Manager on the Visual Studio team developing tools for SharePoint development. Mike gives us a great introduction and overview of these tools from the Visual Studio Developer perspective. Mike shows us how easy it is to build, package, deploy and debug SharePoint 2010 customizations by walking through a site workflow, event receiver, visual web part, the feature and package designers as well as other goodies. This is a great intro for Visual Studio developers looking to get into SharePoint development, but seasoned SharePoint developers will also appreciate the new tools presented here:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Channel 9 Interview: &lt;/strong&gt;&lt;a href="http://channel9.msdn.com/posts/funkyonex/Overview-of-SharePoint-Development-in-Visual-Studio-2010/"&gt;&lt;strong&gt;Overview of SharePoint Development in Visual Studio 2010&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For more information on SharePoint Development in Visual Studio 2010 please check out:&lt;/p&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx"&gt;SharePoint 2010 Development Resources &lt;/a&gt;&lt;a href="http:///"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Sharepoint"&gt;SharePoint Development in Visual Studio 2010 Walkthroughs &lt;/a&gt;&lt;a href="http:///"&gt;&lt;/a&gt;&lt;/li&gt;  &lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;SharePoint Development in Visual Studio 2010 Samples&lt;/a&gt;&lt;a href="http://code.msdn.microsoft.com/SharePointDev2010"&gt;&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/sharepoint"&gt;SharePoint Team Blog&lt;/a&gt; &lt;/li&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/vsto"&gt;Office Development in Visual Studio Team Blog&lt;/a&gt;     &lt;p&gt;And &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopmentprerelease/threads"&gt;give us your feedback in the SharePoint Development Forums&lt;/a&gt;! &lt;/p&gt;    &lt;p&gt;Enjoy!&lt;/p&gt; &lt;/li&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9923265" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Channel9/default.aspx">Channel9</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category></item><item><title>New Channel 9 Videos on Visual Studio 2010</title><link>http://blogs.msdn.com/bethmassi/archive/2009/10/27/new-channel-9-videos-on-visual-studio-2010.aspx</link><pubDate>Tue, 27 Oct 2009 18:29:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9913621</guid><dc:creator>Beth Massi</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9913621.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9913621</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9913621</wfw:comment><description>&lt;p&gt;I’ve noticed that folks have been busy creating video content on the &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/10/19/visual-studio-2010-beta-2-is-here.aspx" target="_blank"&gt;newly released Visual Studio 2010 Beta 2&lt;/a&gt; while I’ve been gone!&amp;#160; (I’ve got a couple up my sleeve that I’ll post soon as well ;-))&lt;/p&gt;  &lt;p&gt;For instance, Kathleen’s continuing her &lt;a href="http://blogs.msdn.com/kathleen/archive/tags/VS2010/default.aspx" target="_blank"&gt;series of Visual Studio 2010 interviews&lt;/a&gt;, this time she’s got &lt;a href="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx"&gt;Norm Estabrook&lt;/a&gt; talking us through how to &lt;a href="http://blogs.msdn.com/kathleen/archive/2009/10/21/creating-an-external-list-in-sharepoint-by-using-business-data.aspx" target="_blank"&gt;create a SharePoint external list using the BDC designer in Visual Studio 2010&lt;/a&gt; and Mick Alberts on the “no PIAs” feature, &lt;a href="http://blogs.msdn.com/kathleen/archive/2009/10/23/embedding-type-information-from-microsoft-office-assemblies.aspx"&gt;Embedding Type Information from Microsoft Office Assemblies&lt;/a&gt;. I’m told she’ll be releasing another one with Norm this week on building a SharePoint Web part with VS2010 so keep an eye out on &lt;a href="http://blogs.msdn.com/kathleen/" target="_blank"&gt;her blog&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;A lot of other folks are creating content on Channel 9 around Visual Studio 2010 so &lt;a href="http://channel9.msdn.com/tags/Visual+Studio+2010/" target="_blank"&gt;check out the feed&lt;/a&gt;. Some recent notables:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-33-Downloading-and-Installing-Visual-Studio-2010-Beta-2/"&gt;10-4 Episode 33: Downloading and Installing Visual Studio 2010 Beta 2&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/Charles/Rico-Mariani-Inside-Visual-Studio-Beta-2-Performance-and-Reliability/"&gt;Rico Mariani: Inside Visual Studio Beta 2 - Performance and Reliability&lt;/a&gt;&amp;#160;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/elisaj/Developing-Data-tier-Applications-using-Visual-Studio-2010/"&gt;Developing Data-tier Applications using Visual Studio 2010&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/kmcgrath/Creating-an-External-List-in-SharePoint-by-Using-Business-Data/"&gt;Creating an External List in SharePoint by Using Business Data&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://channel9.msdn.com/posts/kmcgrath/Embedding-Type-Information-from-Microsoft-Office-Assemblies/"&gt;Embedding Type Information from Microsoft Office Assemblies&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://channel9.msdn.com/tags/Visual+Studio+2010/" target="_blank"&gt;Stay tuned on this channel for more….&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9913621" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>OBA Part 5 - Building the SharePoint 2007 Workflow</title><link>http://blogs.msdn.com/bethmassi/archive/2009/04/21/oba-part-5-building-the-sharepoint-2007-workflow.aspx</link><pubDate>Wed, 22 Apr 2009 08:06:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9561302</guid><dc:creator>Beth Massi</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9561302.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9561302</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9561302</wfw:comment><description>&lt;p&gt;In my last few app building posts we've been building a simple Office Business Application (OBA) for the new Northwind Traders. If you missed them:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx"&gt;OBA Part 1 - Exposing Line-of-Business Data&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/07/oba-part-2-building-and-outlook-client-against-lob-data.aspx"&gt;OBA Part 2 - Building and Outlook Client against LOB Data&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx"&gt;OBA Part 3 - Storing and Reading Data in Word Documents&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/03/08/oba-part-4-building-an-excel-client-against-lob-data.aspx" target="_blank"&gt;OBA Part 4 - Building an Excel Client against LOB Data&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Today we're going to build out the SharePoint workflow using Visual Studio 2008 SharePoint 2007 workflow templates. There's a plethora of &lt;a href="http://msdn.microsoft.com/en-us/library/bb386211.aspx" target="_blank"&gt;information on building these in the MSDN library&lt;/a&gt;. In order to develop against SharePoint you will need to set up your development environment properly so I &lt;a href="http://msdn.microsoft.com/en-us/library/cc160738.aspx" target="_blank"&gt;would read this first&lt;/a&gt; if you're just getting started. My SharePoint development environment is a 32bit Windows 2008 Server running MOSS 2007 and Visual Studio Professional 2008 Service Pack 1. &lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OBASPDiagram1_4.jpg"&gt;&lt;img title="OBASPDiagram1" style="border-right: 0px; border-top: 0px; display: inline; margin: 10px 0px 0px 5px; border-left: 0px; border-bottom: 0px" height="342" alt="OBASPDiagram1" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OBASPDiagram1_thumb_1.jpg" width="420" align="right" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you recall &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/02/building-an-office-business-application-for-techready-8.aspx"&gt;our architecture diagram of our Northwind Traders OBA&lt;/a&gt; involved our Sales Reps submitting purchase orders as Word 2007 documents up to SharePoint which kicked off a workflow to parse the document and update the database with the order data through our data service. This allows us to store the unstructured document on SharePoint and the structured order data in our database. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx" target="_blank"&gt;In Part 3&lt;/a&gt; we built the code that does the parsing of the document, now we just need to get that code into our workflow. We’ll also build in a delay so that the workflow can check the database later to see if the order has been shipped and update the status appropriately. We’ll also take advantage of SharePoint’s workflow history and task list to report outcomes or any issues that may arise.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Creating a Document Library for the Purchase Order Documents&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For this example we need to add a document library called &lt;em&gt;Orders &lt;/em&gt;for the purchase order documents that are submitted. To create the document library, navigate to your SharePoint site and then in the right-had upper corner drop down the Site Actions, select Create (or just navigate to /_layouts/create.aspx) and then under Libraries select &lt;em&gt;Document Library. &lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA1A_2.jpg"&gt;&lt;img title="SPOBA1A" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="SPOBA1A" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA1A_thumb.jpg" width="661" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The only other property that I changed here is the document template, change that to &lt;em&gt;Microsoft Office Word Document &lt;/em&gt;and then hit the Create button. This will bring you to the doc library and you’ll see the default fields in the column headers. We’re going to need to modify these to show the Order Status, an Order Number, the Shipped Date and the email address of the Sales Rep that submitted the order.&lt;/p&gt;  &lt;p&gt;Click on Settings then select &lt;em&gt;Create column&lt;/em&gt; to create new columns for the orders in the document library. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA2A_2.jpg"&gt;&lt;img title="SPOBA2A" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="443" alt="SPOBA2A" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA2A_thumb.jpg" width="659" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;For this example I added the following columns:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;em&gt;Order Status&amp;#160; &lt;br /&gt;&lt;/em&gt;Choice (New, Processed, Shipped, On Hold, Canceled)       &lt;br /&gt;Required = &lt;b&gt;No        &lt;br /&gt;&lt;/b&gt;Default = New       &lt;br /&gt;Add to Default View &lt;/li&gt;    &lt;li&gt;&lt;em&gt;Order Number&lt;/em&gt;       &lt;br /&gt;Single line of text       &lt;br /&gt;Required = &lt;b&gt;No&amp;#160; &lt;br /&gt;&lt;/b&gt;Add to Default View &lt;/li&gt;    &lt;li&gt;&lt;em&gt;Shipped Date        &lt;br /&gt;&lt;/em&gt;Date Only (no Time)       &lt;br /&gt;Required = &lt;strong&gt;No        &lt;br /&gt;&lt;/strong&gt;Add to Default View &lt;/li&gt;    &lt;li&gt;&lt;em&gt;Sales Rep Email        &lt;br /&gt;&lt;/em&gt;Single line of text       &lt;br /&gt;Required = &lt;b&gt;Yes&amp;#160; &lt;br /&gt;&lt;/b&gt;Add to Default View &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA3A_2.jpg"&gt;&lt;img title="SPOBA3A" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="419" alt="SPOBA3A" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA3A_thumb.jpg" width="596" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After I added these columns I added a new default view to display them in the order I want. Click on the Settings again and select C&lt;em&gt;reate view.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA4_2.jpg"&gt;&lt;img title="SPOBA4" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="200" alt="SPOBA4" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA4_thumb.jpg" width="647" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The only thing the user is required to fill out when they upload a new purchase order document is the sales rep’s email address. (Recall that we added this field to the database &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx" target="_blank"&gt;when we built the data service&lt;/a&gt;). The Order Status and Shipped Date will actually be filled out automatically by the workflow depending on whether the order is new or has been updated by the Excel client (&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/03/08/oba-part-4-building-an-excel-client-against-lob-data.aspx" target="_blank"&gt;which we built in the last OBA post&lt;/a&gt;) that the shipping department uses to mark orders as shipped. Order Number will also be assigned by the workflow. We’ll use this to correlate the data with the purchase order document here in the list so we’ll need to add this field to the database. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Adding the Order Number to Northwind &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So now we have the document library set up, we’re almost ready to write the workflow. First we’ll need to add the OrderNumber field to the Orders table in the Northwind database and then refresh our data service service so that this starts to show up as an available field on the Order. &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;USE &lt;/span&gt;Northwind
GO

&lt;span style="color: blue"&gt;ALTER TABLE &lt;/span&gt;dbo.Orders &lt;span style="color: blue"&gt;ADD
    &lt;/span&gt;OrderNumber &lt;span style="color: blue"&gt;nvarchar&lt;/span&gt;(25) &lt;span style="color: blue"&gt;NULL
&lt;/span&gt;GO&lt;/pre&gt;

&lt;p&gt;In order to pick up this new field we need to refresh the Entity Data Model behind our data service. In the NorthwindDataService project open the NorthwindModel.edmx and then right-click on the design surface and select &lt;em&gt;Refresh from database. &lt;/em&gt;This will pick up the OrderNumber field on the Order entity. Rebuild the data service. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Options on Hosting the Data Service for Workflow Development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve been following along and playing with &lt;a href="http://code.msdn.microsoft.com/OBANorthwind"&gt;the sample&lt;/a&gt;, you’ll notice that the NorthwindDataService project is currently set to be hosted in the ASP.NET development server right now so that testing the Excel and Outlook clients is easy. However at this point you may opt to deploy this to IIS instead so that you don’t have to remember to start it up manually every time you want to test the SharePoint Workflow. And of course for deployment to production you’ll need to host it in IIS anyway. &lt;/p&gt;

&lt;p&gt;It gets slightly tricky if you want to host the data service in IIS on the same server as SharePoint because SharePoint takes over Port 80. So the easiest thing to do is to open IIS Manager and just create a new web site on Port 82 called NorthwindHost and then create a new application virtual directory called Northwind under that. By default, when you create a new web site it should also create a new Application Pool for you running under the identity NETWORK SERVICE. The identity you use here will need to have read and execute file permissions on the physical locations of any virtual directories you create as well as proper database permissions. &lt;/p&gt;

&lt;p&gt;It’s XCOPY deployment at that point. Just copy the Web.Config, Northwind.svc and the \bin directory over to the physical location of the Northwind virtual directory and you should be good to go.&amp;#160; You can do this in Visual Studio (if running as an administrator) just right-click on the NorthwindDataService project in the solution explorer and then select publish. Then enter http://localhost:82/Northwind/ (or whatever you named it) and it will build and publish the files there automatically. &lt;/p&gt;

&lt;p&gt;Note however, that before the WCF service will activate you have to install the WCF service handlers into IIS. These may not be installed automatically so in Windows 2008 check the Server Manager, scroll down to the Features Summary and select “Add Features”. Then expand the first node “.NET&amp;#160; 3.0 Features” and check WCF Activation. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Remember if you change the location of the data service then you need to update the settings in the Excel and Outlook client (app.config file). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the SharePoint Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re not doing this already, restart Visual Studio and &lt;strong&gt;Run as Administrator&lt;/strong&gt;. This is necessary so that you can deploy and debug your workflow. Next add a new project to the solution, File –&amp;gt; Add –&amp;gt; New Project. For this example we’re just going to create a simple SharePoint 2007 Sequential Workflow. (Note: You will need Visual Studio 2008 Professional and higher to get these templates.)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA6_2.jpg"&gt;&lt;img title="SPOBA6" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="352" alt="SPOBA6" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA6_thumb.jpg" width="546" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;As I mentioned before the workflow will kick off when a new purchase order is added to the document library in order to parse the data in the document. So when the order is first added to the list it will have a status of &lt;strong&gt;New&lt;/strong&gt;. After it is parsed we will set the status to &lt;strong&gt;Processed&lt;/strong&gt;, which happens right away. Later, after the shipping department enters the shipped date in the Excel client and updates the Orders.ShippedDate field in the database, we need the workflow to wake back up and set the order status to &lt;strong&gt;Shipped&lt;/strong&gt;. For this example I’m going to build a delay into the workflow to check the database (via our data service) every so often. For testing it can be a couple minutes but once we deploy we can set it to every couple hours. Note that if you’re building more statuses or states into your own workflows you may want to take a look at the State Machine Workflow template instead. &lt;/p&gt;

&lt;p&gt;So the next step is to specify where your SharePoint site and document library resides, for development this is going to be http://&lt;em&gt;YourServerName. &lt;/em&gt;Once you specify the site you can then select the Orders document library in the Library dropdown. Leave “Automatically associate workflow?” checked so that Visual Studio can deploy the workflow to the site automatically for us. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA8_2.jpg"&gt;&lt;img title="SPOBA8" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="273" alt="SPOBA8" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA8_thumb.jpg" width="345" border="0" /&gt;&lt;/a&gt; &lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA9_2.jpg"&gt;&lt;img title="SPOBA9" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="275" alt="SPOBA9" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA9_thumb.jpg" width="344" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;On the next page check off how you want to start the workflow. For this example we’ll select “When an item is created”. You can also check “Manually by users” which can be helpful when testing but it’s not necessary for our example. Note that you can change these settings later on the Workflow project -- from the Project menu select “SharePoint debug settings..”. You need to be running Visual Studio as an administrator to open these settings. &lt;strong&gt;You’ll need to do this if you’re going to run the Workflow in the &lt;/strong&gt;&lt;a href="http://code.msdn.microsoft.com/OBANorthwind"&gt;&lt;strong&gt;sample code&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; against your own SharePoint site.&amp;#160; &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the project is created it will automatically add a workflow called Workflow1 and open the designer which will display an event activity for onWorkflowActivated. An OnWorkflowActivated activity must be the first activity in a Windows SharePoint Services workflow so Visual Studio automatically sets one up for us. I renamed Workflow1 to ProcessOrder in the Solution Explorer (I like descriptive names ;-)) which means I’ll also need to update the values for the CorrelationToken.OwnerActivityName as well as the WorkflowProperties.Name to set them to ProcessOrder: &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA10_2.jpg"&gt;&lt;img title="SPOBA10" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="260" alt="SPOBA10" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA10_thumb.jpg" width="709" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now you can start laying out the design of the workflow. If you have used the WF designer before then this part should be familiar. Take a look at your toolbox and you’ll see the SharePoint specific activities listed under the Workflow 3.0 and 3.5 tabs. The design of the workflow for this example will be simple. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA7_4.jpg"&gt;&lt;img title="SPOBA7" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="562" alt="SPOBA7" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA7_thumb_1.jpg" width="536" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;There are three main blocks to the workflow that we’re going to build:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;First is the parsing of the order data in the document which is a standard code activity that you find in the Windows Workflow v3.0 tab on the toolbox. &lt;/li&gt;

  &lt;li&gt;The second block is a standard While loop that contains a delay activity. This piece will periodically query the database until the Order.ShipDate is updated in the database by the Excel client. &lt;/li&gt;

  &lt;li&gt;The third block will be an IfElse activity which will check the Order status and either write an informational message to the History list in the case the order shipped successfully, otherwise we create a Task and assign it to the administrator for further investigation. The LogToHistoryListActivity and the CreateTask items can be found in the SharePoint Workflow tab on the toolbox. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before we start writing the workflow code, let’s create some constants that we can use to refer to the data service URI, our order statuses, and list column names (I just added a new Module called Constants.vb):&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Friend Module &lt;/span&gt;Constants
    &lt;span style="color: blue"&gt;Public Const &lt;/span&gt;OrderStatusColumn &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Order Status&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;OrderNumberColumn &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Order Number&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;ShippedDateColumn &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Shipped Date&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;SalesRepEmailColumn &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Sales Rep Email&amp;quot;

    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;NewStatus &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;New&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;ShippedStatus &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Shipped&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;ProcessedStatus &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Processed&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;OnHoldStatus &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;On Hold&amp;quot;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;CanceledStatus &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;Canceled&amp;quot;

&lt;/span&gt;&lt;span style="color: green"&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Const &lt;/span&gt;ServiceURL &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;http://localhost:82/NorthwindService/Northwind.svc&amp;quot;
&lt;/span&gt;&lt;span style="color: blue"&gt;End Module&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Parsing the Order Document &lt;strong&gt;(CodeActivity parseOrder) &lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Workflow kicks off immediately after a purchase order document is checked into the document library. The first code activity out of the gate is parsing the order document’s customXML for the order data we need. I already &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx"&gt;demonstrated a simple console application for extracting the order data from a Word document in Part 3&lt;/a&gt;. This code uses the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&amp;amp;DisplayLang=en"&gt;Open XML SDK&lt;/a&gt; so you’ll need to download that and install it on your SharePoint server so that the assemblies are in the GAC. Then add an assembly reference to DocumentFormat.OpenXML. &lt;/p&gt;

&lt;p&gt;From that console application project I copied the DocumentOderData.vb, Extensions.vb code files and the OrderEntry.xsd into the workflow project. Module1.vb had a method called ParseOrderDocument which parsed the docx file and populated a DocumentOrderData class with the information. I took that code and created a new class called Shredder and modified the interface a bit so that we could pass it a Microsoft.Sharepoint.SPFile class instead: &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;DocumentFormat.OpenXml.Packaging
&lt;span style="color: blue"&gt;Imports &lt;/span&gt;&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #b96464"&gt;xmlns&lt;/span&gt;&lt;span style="color: #6464b9"&gt;=&lt;/span&gt;&lt;span style="color: #555555"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #6464b9"&gt;urn:microsoft:examples:oba&lt;/span&gt;&lt;span style="color: #555555"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #6464b9"&gt;&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;Shredder

    &lt;span style="color: blue"&gt;Public Function &lt;/span&gt;ParseOrderDocument(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;docFile &lt;span style="color: blue"&gt;As &lt;/span&gt;SPFile) &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData
        &lt;span style="color: blue"&gt;Using &lt;/span&gt;docStream = docFile.OpenBinaryStream
            &lt;span style="color: blue"&gt;Return &lt;/span&gt;ParseOrderDocument(WordprocessingDocument.Open(docStream, &lt;span style="color: blue"&gt;False&lt;/span&gt;))
        &lt;span style="color: blue"&gt;End Using
    End Function

&lt;/span&gt;&lt;span style="color: gray"&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Function &lt;/span&gt;ParseOrderDocument(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;wordDoc &lt;span style="color: blue"&gt;As &lt;/span&gt;WordprocessingDocument) &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData&lt;br /&gt;...&lt;/pre&gt;

&lt;p&gt;We also had a means for adding this data to the database via a method called AddNewOrder. The only change we need here is to create a unique OrderNumber string, add it to the Order entity, and return it to the workflow so we can also set it on the list item in SharePoint. You can decide how you want to generate unique order numbers, whether you want them to be GIUDs or timestamps or some other random number. I like using a combination of the CustomerID and the current date&amp;amp;time so that it’s human readable.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;orderNum = Replace(Replace(Replace(cust.CustomerID &amp;amp; Now.ToString(), &lt;span style="color: #a31515"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;), &lt;span style="color: #a31515"&gt;&amp;quot;:&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;), &lt;span style="color: #a31515"&gt;&amp;quot; &amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;)&lt;/pre&gt;

&lt;p&gt;This will work as long as there aren’t two orders for the same customer submitted within the same second so depending on your actual scenario you may opt for a different strategy :-). So this AddNewOrder code I placed into a class called OrderManager which also encapsulates all calls to the data service. Speaking of our data service, we’ll need to add a Service Reference to the workflow project called NorthwindService (right-click on the workflow project and select Add Service Reference) which will add the database entity types to our project. &lt;/p&gt;

&lt;p&gt;Now drop a CodeActivity onto the Workflow designer and in the properties window name it parseOrder. Then right-click on it in the designer and select Generate Handlers to automatically generate the parseOrder_ExecuteCode handler. If the order data is extracted and added to the database successfully then an order number is assigned and the status is set to Processed. If the document does not contain the &amp;lt;OrderEntry&amp;gt; CustomXML then the status will be set to Canceled. If there is a problem adding the data to the database then the status is set to On Hold. (Notice that this code also uses the Application.Log to write messages to the Event Log which you can &lt;a href="http://msdn.microsoft.com/en-us/library/07347hdt.aspx"&gt;see how to set up here&lt;/a&gt;.)&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;ProcessOrder
    &lt;span style="color: blue"&gt;Inherits &lt;/span&gt;SequentialWorkflowActivity

    &lt;span style="color: blue"&gt;Public &lt;/span&gt;workflowProperties &lt;span style="color: blue"&gt;As New &lt;/span&gt;SPWorkflowActivationProperties
    &lt;span style="color: blue"&gt;Public Sub New&lt;/span&gt;()
        &lt;span style="color: blue"&gt;MyBase&lt;/span&gt;.New()
        InitializeComponent()
    &lt;span style="color: blue"&gt;End Sub

    Private Sub &lt;/span&gt;parseOrder_ExecuteCode(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Object, _
                                       &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.EventArgs)
        &lt;span style="color: green"&gt;'This method is executed once the purchase order is uploaded 
        ' and checked into the document library 
        &lt;/span&gt;&lt;span style="color: blue"&gt;Try
            Dim &lt;/span&gt;orderNumber &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;shredder &lt;span style="color: blue"&gt;As New &lt;/span&gt;Shredder

            &lt;span style="color: green"&gt;'Valid OrderStatus: New, Processed, Shipped, Cancelled, On Hold
            ' (See Constants.vb for column and status strings)
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;status = workflowProperties.Item(OrderStatusColumn).ToString()

            &lt;span style="color: blue"&gt;If &lt;/span&gt;status = NewStatus &lt;span style="color: blue"&gt;Then
                &lt;/span&gt;&lt;span style="color: green"&gt;'Get order data out of the document
                &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;docData = shredder.ParseOrderDocument(&lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.File)

                &lt;span style="color: blue"&gt;If &lt;/span&gt;docData &lt;span style="color: blue"&gt;IsNot Nothing Then
                    Dim &lt;/span&gt;manager &lt;span style="color: blue"&gt;As New &lt;/span&gt;OrderManager
                    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;employeeEmail = workflowProperties.Item(SalesRepEmailColumn).ToString()

                    &lt;span style="color: green"&gt;'Add order data to the DB (through the service) and return the order number.
                    &lt;/span&gt;orderNumber = manager.AddNewOrder(docData, employeeEmail)

                    &lt;span style="color: blue"&gt;If &lt;/span&gt;orderNumber &amp;lt;&amp;gt; &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt;Then
                        &lt;/span&gt;status = ProcessedStatus
                        &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteEntry( _
                            &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order {0} added to database successfully.&amp;quot;&lt;/span&gt;, _
                                          orderNumber), TraceEventType.Information)
                    &lt;span style="color: blue"&gt;Else
                        &lt;/span&gt;status = OnHoldStatus
                        &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteEntry( _
                            &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order could not be added to database for {0}.&amp;quot;&lt;/span&gt;, _
                                          &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.Name), TraceEventType.Error)
                    &lt;span style="color: blue"&gt;End If
                Else
                    &lt;/span&gt;status = CanceledStatus
                    &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteEntry( _
                        &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Invalid purchase order submitted for {0}&amp;quot;&lt;/span&gt;, _
                                      &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.Name), TraceEventType.Error)
                &lt;span style="color: blue"&gt;End If
            End If

            If &lt;/span&gt;status &amp;lt;&amp;gt; &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt;Then
                Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn) = status
                &lt;span style="color: blue"&gt;If &lt;/span&gt;orderNumber.Length() &amp;gt; 0 &lt;span style="color: blue"&gt;Then
                    Me&lt;/span&gt;.workflowProperties.Item(OrderNumberColumn) = orderNumber
                &lt;span style="color: blue"&gt;End If
                Me&lt;/span&gt;.workflowProperties.Item.Update()
            &lt;span style="color: blue"&gt;End If

        Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
            &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteException(ex)
        &lt;span style="color: blue"&gt;End Try

    End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Now that the order is in the database, you can open &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/03/08/oba-part-4-building-an-excel-client-against-lob-data.aspx"&gt;the Excel client we wrote in part 4&lt;/a&gt; and enter a ShippedDate and click save to update the order. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Querying the Database Periodically (&lt;strong&gt;WhileActivity waitForProcessed&lt;/strong&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next we need a WhileActivity so that we can check the database to see if the ShippedDate has been updated. Drag a standard While activity from the toolbox under the parseOrder and name it waitForProcessed in the properties window. Right-click on the designer and select View Code and write the following method:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;    Private Sub &lt;/span&gt;orderProcessed(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Object, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;ConditionalEventArgs)
      &lt;span style="color: blue"&gt;Try
            Dim &lt;/span&gt;status = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn).ToString()
            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;orderNumber = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(Constants.OrderNumberColumn).ToString()

            &lt;span style="color: blue"&gt;If &lt;/span&gt;status &amp;lt;&amp;gt; ProcessedStatus &lt;span style="color: blue"&gt;Then
                &lt;/span&gt;&lt;span style="color: green"&gt;'End while branch and go to next step in sequence if status is:
                '  Canceled = invalid purchase order (no &amp;lt;OrderEntry&amp;gt; CustomXML found)
                '  On Hold = Could not add data to database (see error log for details)
                &lt;/span&gt;e.Result = &lt;span style="color: blue"&gt;False
            Else
                &lt;/span&gt;&lt;span style="color: green"&gt;'Get order from DB
                &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;manager &lt;span style="color: blue"&gt;As New &lt;/span&gt;OrderManager
                &lt;span style="color: blue"&gt;Dim &lt;/span&gt;processedOrder = manager.GetOrder(orderNumber)

                &lt;span style="color: green"&gt;'If order was shipped (ShippedDate not NULL) then set Order Status to Shipped.
                &lt;/span&gt;&lt;span style="color: blue"&gt;If &lt;/span&gt;processedOrder &lt;span style="color: blue"&gt;IsNot Nothing Then
                    If &lt;/span&gt;processedOrder.ShippedDate &lt;span style="color: blue"&gt;IsNot Nothing AndAlso &lt;/span&gt;_
                       processedOrder.ShippedDate.HasValue &lt;span style="color: blue"&gt;Then
                        My&lt;/span&gt;.Application.Log.WriteEntry( _
                            &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order {0} has shipped as of {1}&amp;quot;&lt;/span&gt;, _
                                          orderNumber, Now()), TraceEventType.Information)

                        &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn) = ShippedStatus
                        &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(ShippedDateColumn) = processedOrder.ShippedDate
                        &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.Update()
                        &lt;span style="color: green"&gt;'end while branch and go to next step in sequence
                        &lt;/span&gt;e.Result = &lt;span style="color: blue"&gt;False
                    Else
                        My&lt;/span&gt;.Application.Log.WriteEntry( _
                            &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order {0} has not shipped as of {1}&amp;quot;&lt;/span&gt;, _
                                          orderNumber, Now()), TraceEventType.Warning)
                        &lt;span style="color: green"&gt;'keep workflow running until shipped or canceled
                        &lt;/span&gt;e.Result = &lt;span style="color: blue"&gt;True
                    End If
                Else
                    My&lt;/span&gt;.Application.Log.WriteEntry( _
                        &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order {0} has been deleted from the database&amp;quot;&lt;/span&gt;, _
                                      orderNumber, Now()), TraceEventType.Error)&lt;br /&gt;
                    &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn) = CanceledStatus
                    &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.Update()
                    &lt;span style="color: green"&gt;'end while branch and go to next step in sequence
                    &lt;/span&gt;e.Result = &lt;span style="color: blue"&gt;False
                End If
            End If

        Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
            &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteException(ex)
        &lt;span style="color: blue"&gt;End Try

    End Sub&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Notice in this code we’re referring to a method on the OrderManager called GetOrder which simply queries the Order entity from the database via the data service using LINQ:&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;OBADemoWorkflow.NorthwindServiceReference

&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;OrderManager
    &lt;span style="color: blue"&gt;Private &lt;/span&gt;ctx &lt;span style="color: blue"&gt;As New &lt;/span&gt;NorthwindEntities(&lt;span style="color: blue"&gt;New &lt;/span&gt;Uri(Constants.ServiceURL))&lt;br /&gt;
&lt;span style="color: blue"&gt;    Public Function &lt;/span&gt;AddNewOrder(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;docData &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData, _&lt;br /&gt;                                &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;employeeEmail &lt;span style="color: blue"&gt;As String&lt;/span&gt;) &lt;span style="color: blue"&gt;As String...

&lt;/span&gt;&lt;span style="color: gray"&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;Public Function &lt;/span&gt;GetOrder(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;orderNumber &lt;span style="color: blue"&gt;As String&lt;/span&gt;) &lt;span style="color: blue"&gt;As &lt;/span&gt;Order
        &lt;span style="color: blue"&gt;Try
            Dim &lt;/span&gt;theOrder = (&lt;span style="color: blue"&gt;From &lt;/span&gt;o &lt;span style="color: blue"&gt;In &lt;/span&gt;ctx.Orders _
                            &lt;span style="color: blue"&gt;Where &lt;/span&gt;o.OrderNumber = orderNumber).FirstOrDefault()

            &lt;span style="color: blue"&gt;Return &lt;/span&gt;theOrder

        &lt;span style="color: blue"&gt;Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
            &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteException(ex)
            &lt;span style="color: blue"&gt;Return Nothing
        End Try
    End Function
End Class&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA11_2.jpg"&gt;&lt;img title="SPOBA11" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 10px 0px 0px; border-left: 0px; border-bottom: 0px" height="166" alt="SPOBA11" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA11_thumb.jpg" width="233" align="left" border="0" /&gt;&lt;/a&gt; Now you can go back to the designer and set the Condition on the waitForProcessed WhileActivity to the orderProcessed method. Set the Condition to a Code Condition and the dropdown will contain only those methods that have the right signature, i.e. have a ConditionalEventArgs parameter. The orderProcessed method will set the e.Result = True only if the order is in the Processed state, is still in the database, and its ShippedDate is still NULL. This means that the While activity will continue to run. &lt;/p&gt;

&lt;p&gt;Because the shipping department most likely will not ship the order out the door the second the order is entered into the database (&amp;lt;g&amp;gt;), we need a way for our workflow to delay and check periodically. Depending on your business you may want to check hourly or even daily. For testing you probably want to check every minute or two. This is where the DelayActivity comes in. Drag a standard Delay activity onto the designer inside the While Activity and set the Timeout Duration in the properties window to 3 minutes or so. &lt;/p&gt;

&lt;p&gt;Before we go on I want to mention that there were known issues with the Delay activities not firing correctly in SharePoint that are addressed by this KB Article: &lt;a title="http://support.microsoft.com/kb/953630/" href="http://support.microsoft.com/kb/953630/"&gt;http://support.microsoft.com/kb/953630/&lt;/a&gt;. The SharePoint timer service (OWSTIMER.exe) is set to only wake up every 5 minutes, so you probably want to set that to a shorter interval in your testing environment otherwise you’ll have to wait at least 5 minutes no matter how short you set your Delay activity. Another other issue I noticed was sometimes on rebuild &amp;amp; redeployment I needed to restart the timer service manually from an admin command prompt:&lt;/p&gt;

&lt;p&gt;&amp;gt;Net Stop SPTimerV3
  &lt;br /&gt;&amp;gt;iisreset

  &lt;br /&gt;&amp;gt;Net Start SPTimerV3&lt;/p&gt;

&lt;p&gt;Also there is an issue with debugging delays. I couldn’t just press F5 to debug the workflow after the delay. Up until that point I debugged just fine (which is where almost all our code is in this example) but if I wanted to see the rest of the code execute after the delay then I needed to attach to the OWSTIMER.exe process (while you’re debugging, on the main menu select Tools –&amp;gt; Attach to Process). This is also one of&amp;#160; the reasons why I enabled the Application.Log to send messages to the Event Log. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrapping Up the Workflow (History Logging and Creating Tasks)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The last piece of the workflow is simple, if the order is shipped we’ll just log a message to the workflow history list otherwise we’ll create a task for the administrator to investigate. Drop an IfElse activity under the While activity set and name it checkIfShipped. Then name the first branch ifShipped and the second branch elseNotShipped. In the ifShipped branch drop a LogToHistoryListActivity which is found in the SharePoint Workflow tab on the Toolbox. In the elseNotShipped drop a CreateTask activity. On the properties window for the CreateTask create a new field binding for both the TaskID and TaskProperties and enter a correlationToken with the parent activity set to ProcessOrder (the workflow). &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA12_2.jpg"&gt;&lt;img title="SPOBA12" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="297" alt="SPOBA12" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/SPOBA12_thumb.jpg" width="709" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Then right-click on both the CreateTask and LogToHistoryActivity and select Generate Handlers in order to generate the method stubs for each of them. We’ll also need a method called isOrderShipped with the same signature as the orderProcessed method above to be able to set it as the Code Condition of the ifShipped branch. We need to check the workflowProperties.Item for the order status and set the e.Result = True if the status is Shipped. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;isOrderShipped(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As Object&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;ConditionalEventArgs)
&lt;span style="color: green"&gt;    'Returns True if Order Status equals Shipped
    &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;status = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn).ToString()
    e.Result = (status = ShippedStatus)
&lt;span style="color: blue"&gt;End Sub

Private Sub &lt;/span&gt;createTask1_MethodInvoking(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Object, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.EventArgs)
    &lt;span style="color: blue"&gt;Try
        &lt;/span&gt;&lt;span style="color: green"&gt;'This will execute if the workflow is ending but the Order Status 
        ' is not Shipped (i.e. Canceled or On Hold). 
        ' This code creates a workflow task item so the AssignedTo can investigate.
        &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;status = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item(OrderStatusColumn).ToString()
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;name = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.workflowProperties.Item.Name

        createTask1_TaskId1 = Guid.NewGuid()
        createTask1_TaskProperties1.AssignedTo = &lt;span style="color: #a31515"&gt;&amp;quot;obavm09\wssdeveloper&amp;quot;
        &lt;/span&gt;createTask1_TaskProperties1.Title = &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Problem with order {0}&amp;quot;&lt;/span&gt;, name)
        createTask1_TaskProperties1.Description = &lt;span style="color: blue"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;Order {0} as of {1}&amp;quot;&lt;/span&gt;, status, Now)
    &lt;span style="color: blue"&gt;Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
        &lt;span style="color: blue"&gt;My&lt;/span&gt;.Application.Log.WriteException(ex)
    &lt;span style="color: blue"&gt;End Try
End Sub

Private Sub &lt;/span&gt;logToHistoryListActivity1_MethodInvoking(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As &lt;/span&gt;System.Object, _&lt;br /&gt;                                                     &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.EventArgs)
    logToHistoryListActivity1.HistoryOutcome = &lt;span style="color: #a31515"&gt;&amp;quot;Order has been shipped.&amp;quot;
&lt;/span&gt;&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Testing the Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Visual Studio (still running as Administrator) Rebuild the solution. Then right-click on the OBADemoWorkflow project and select Deploy from the context menu. Now we can head over to the document library and upload some purchase orders. I used the one we created previously in &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx"&gt;Part 3&lt;/a&gt; with ALFKI as the CustomerID. Go to the Orders document library, click Upload, Browse for the purchase order and click OK. Then fill out the required field Sales Rep Email (this is the Employee.EmailAddress field we added to the database in &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx"&gt;Part 1&lt;/a&gt;). Once you click “Check In” the workflow will kick off. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow1_2.jpg"&gt;&lt;img title="OrderWorkflow1" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="352" alt="OrderWorkflow1" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow1_thumb.jpg" width="639" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The Order status is first set to “New”….&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow2_2.jpg"&gt;&lt;img title="OrderWorkflow2" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="352" alt="OrderWorkflow2" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow2_thumb.jpg" width="663" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;But if you quickly refresh the list you will see that the Order Status and Order Number change as the order is processed and entered into the database. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow3_2.jpg"&gt;&lt;img title="OrderWorkflow3" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="352" alt="OrderWorkflow3" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow3_thumb.jpg" width="658" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now the workflow is in its delay activity waiting for us to update the Order.ShippedDate. Open up the Excel client and enter something in the ShippedDate field and save the sheet (or manually modify the database). The next time the SharePoint timer runs it will waken our delay which will check the database again and set the status appropriately.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow4_2.jpg"&gt;&lt;img title="OrderWorkflow4" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="352" alt="OrderWorkflow4" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart4BuildingtheSharePointWorkFlow_D714/OrderWorkflow4_thumb.jpg" width="661" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you select the OBADemoWorkflow status (the last column in the view which is added automatically for us when we deploy) then you can see the status message in the Workflow History list. To see a task get created you can perform the same process but instead of updating the ShippedDate, delete the Order from the database (or delete the OrderNumber) and the workflow will set the status to Canceled and you will see a task in the list instead. And remember in testing we set the delay to a few minutes but in production Northwind Traders will be good with a 12 hour delay (gourmet foods don’t ship that quickly ;-)). &lt;/p&gt;

&lt;p&gt;I’ve added this workflow to the &lt;a href="http://code.msdn.com/obanorthwind"&gt;sample code we’ve been building up on Code Gallery&lt;/a&gt; so have a look. I hope this real(er)-world, componentized sample has given you a good introduction into OBA and some of the awesome VSTO features of Visual Studio 2008. &lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9561302" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Article/default.aspx">Article</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Office/default.aspx">Office</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Workflow/default.aspx">Workflow</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/OBA/default.aspx">OBA</category></item><item><title>OBA Part 3 - Storing and Reading Data in Word Documents</title><link>http://blogs.msdn.com/bethmassi/archive/2009/02/12/oba-part-3-storing-and-reading-data-in-word-documents.aspx</link><pubDate>Fri, 13 Feb 2009 04:55:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9416665</guid><dc:creator>Beth Massi</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9416665.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9416665</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9416665</wfw:comment><description>&lt;p&gt;In my last few posts we've been building a simple Office Business Application (OBA) for the new Northwind Traders. If you missed them:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx" target="_blank"&gt;OBA Part 1 - Exposing Line-of-Business Data&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/07/oba-part-2-building-and-outlook-client-against-lob-data.aspx" target="_blank"&gt;OBA Part 2 - Building and Outlook Client against LOB Data&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In this post I'm going to talk about how we can create a purchase order in Word 2007 that contains data about the items being purchased and how we can query that data and place it into our database. We'll use this code as a basis for our SharePoint Workflow which we will build out in the next post. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/WordOBADiagram_2.jpg"&gt;&lt;img style="margin: 0px 10px 0px 0px" height="375" alt="WordOBADiagram" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/WordOBADiagram_thumb.jpg" width="389" align="left" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you recall &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/02/building-an-office-business-application-for-techready-8.aspx" target="_blank"&gt;our architecture diagram of our Northwind Traders OBA&lt;/a&gt; involved our Sales Reps submitting purchase orders as Word 2007 documents up to SharePoint which kicked off a workflow to parse the document and update the database with the order data through our data service.&lt;/p&gt;  &lt;p&gt;This allows us to store the unstructured document on SharePoint and the structured order data in our database. &lt;/p&gt;  &lt;p&gt;However before we build out the SharePoint Workflow we need a clean way to store and then retrieve the structured order data inside the Word 2007 document. Since Word 2007 documents are Open XML we can use the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&amp;amp;DisplayLang=en" target="_blank"&gt;Open XML SDK&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/bb384460.aspx" target="_blank"&gt;LINQ to XML&lt;/a&gt; to easily parse the document. (I've talked about how to &lt;a href="http://blogs.msdn.com/bethmassi/archive/2008/07/30/accessing-openxml-document-parts-with-the-openxml-sdk.aspx" target="_blank"&gt;manipulate documents with Open XML SDK before here&lt;/a&gt;.) &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Content Controls&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;One way to store data in an Word 2007 document is by using content controls. These allow you to define specific data areas/fields in the document which are then bound to XML that is placed inside the document. When users enter data into these areas of the document the data is stored as a CustomXML Part inside the document. You can use &lt;a href="http://msdn.microsoft.com/en-us/library/bb398244.aspx" target="_blank"&gt;Visual Studio to create content controls and map them to XML&lt;/a&gt; or you can use Word itself. There's also a nifty tool called the &lt;a href="http://www.codeplex.com/dbe" target="_blank"&gt;Word 2007 Content Control Toolkit&lt;/a&gt; that makes the mapping more visual. I'd also highly recommend installing the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=46B6BF86-E35D-4870-B214-4D7B72B02BF9&amp;amp;displaylang=en" target="_blank"&gt;VSTO Power Tools&lt;/a&gt; as well which includes &lt;a href="http://blogs.msdn.com/bethmassi/archive/2008/07/29/handy-visual-studio-add-in-to-view-office-2007-files.aspx" target="_blank"&gt;a VS Add-In for manipulating Open XML documents&lt;/a&gt;. This allows you to look inside the document easily to inspect all the parts directly within Visual Studio.&lt;/p&gt;  &lt;p&gt;So the first thing to do is to create a purchase order template and lay out the content controls on the document. We'll create something very simple using Microsoft Word 2007. On the Developer tab you will see the Controls section. There you can choose which types of controls to lay out on the document. Click the properties button to assign a friendly title and tag to the control. Here I've laid out the minimum information we'll need to submit an order to the system:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc1_2.jpg"&gt;&lt;img height="438" alt="wordcc1" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc1_thumb.jpg" width="672" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Users can write anything else around the content controls but the system only cares about capturing the data we've specified. This gives us the ability to store structured and unstructured data completely inside the .docx file. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Creating and Mapping the XML&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now we are ready to map the values of the content controls to some custom XML. The XML document for our order looks like this. (Note that there are 10 &amp;lt;OrderDetail&amp;gt; elements I just snipped them for brevity):&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderEntry &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;urn:microsoft:examples:oba&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CustomerID &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDate &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Shipper &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDetails&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDetail&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ProductName &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Quantity &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDetail&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;br /&gt;&lt;span style="color: blue"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDetail&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;...&lt;/span&gt;&lt;span style="color: blue"&gt;
  &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderDetails&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;OrderEntry&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Now open up the &lt;a href="http://www.codeplex.com/dbe" target="_blank"&gt;Word 2007 Content Control Toolkit&lt;/a&gt; an open the OrderEntryTemplate.docx. Under Actions select &amp;quot;Create a new Custom XML Part&amp;quot;, switch to edit view, and then paste in the XML:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc2_2.jpg"&gt;&lt;img height="491" alt="wordcc2" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc2_thumb.jpg" width="594" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Next switch to Bind View and then drag the elements onto the content controls on the left. Make sure you select the element first and then drag it.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc3_2.jpg"&gt;&lt;img height="352" alt="wordcc3" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc3_thumb.jpg" width="629" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Once you're done, save the document and then you can open it in Visual Studio if you've loaded the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=46B6BF86-E35D-4870-B214-4D7B72B02BF9&amp;amp;displaylang=en" target="_blank"&gt;VSTO Power Tools&lt;/a&gt;. This will show the Open XML parts of the document and you can expand the customXml folder and see that our XML has been added to the document. &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc4_2.jpg"&gt;&lt;img height="379" alt="wordcc4" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc4_thumb.jpg" width="660" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If you back into Word and fill out the content controls and then view the document in Visual Studio again, you will see that the item1.xml custom XML part will contain the data we entered. &lt;/p&gt;

&lt;p&gt;Now that we have a purchase order template we can give this to our sales reps who can collaborate with our high volume customers via email to fill it out. They can then submit the purchase orders to a SharePoint list that can run a workflow to extract the order data and update the database through the data service. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using the Open XML SDK to Retrieve the Order Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The easiest way to programmatically manipulate Office 2007 Open XML documents is by using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&amp;amp;DisplayLang=en" target="_blank"&gt;Open XML SDK&lt;/a&gt;. Once you install it you can then Add Reference to the DocumentFormat.OpenXML assembly. In order to use LINQ to XML you'll also need a reference to System.Core and System.Xml.Linq. These are imported automatically when you create a new project in Visual Studio 2008. You'll also need to &lt;a href="http://msdn.microsoft.com/en-us/library/cc668183.aspx" target="_blank"&gt;add a Service Reference to the ADO.NET Data Service&lt;/a&gt; like &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/01/09/using-ado-net-data-services.aspx" target="_blank"&gt;I've shown before&lt;/a&gt;. So let's start simple and just create a console application for now called NorthwindOrderDocParser. Later we'll talk about moving this to a SharePoint workflow. &lt;/p&gt;

&lt;p&gt;Before we start parsing the document let's create a couple simple classes that store the data we're extracting from our document.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' These classes represents the order data that is inside the Word Document. 
''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;DocumentOrderData

    &lt;span style="color: blue"&gt;Sub New&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;customerID &lt;span style="color: blue"&gt;As String&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;orderDate &lt;span style="color: blue"&gt;As Date&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;shipperName &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
        _CustomerID = customerID
        _OrderDate = orderDate
        _Shipper = shipperName
    &lt;span style="color: blue"&gt;End Sub

    Private &lt;/span&gt;_CustomerID &lt;span style="color: blue"&gt;As String
    Public Property &lt;/span&gt;CustomerID() &lt;span style="color: blue"&gt;As String
        Get
            Return &lt;/span&gt;_CustomerID
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
            _CustomerID = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Private &lt;/span&gt;_OrderDate &lt;span style="color: blue"&gt;As Date
    Public Property &lt;/span&gt;OrderDate() &lt;span style="color: blue"&gt;As Date
        Get
            Return &lt;/span&gt;_OrderDate
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As Date&lt;/span&gt;)
            _OrderDate = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Private &lt;/span&gt;_Shipper &lt;span style="color: blue"&gt;As String
    Public Property &lt;/span&gt;Shipper() &lt;span style="color: blue"&gt;As String
        Get
            Return &lt;/span&gt;_Shipper
        &lt;span style="color: blue"&gt;End Get
        Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
            &lt;span style="color: blue"&gt;If &lt;/span&gt;value &lt;span style="color: blue"&gt;Is Nothing OrElse &lt;/span&gt;value.Trim = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt;Then
                &lt;/span&gt;value = &lt;span style="color: #a31515"&gt;&amp;quot;Speedy Express&amp;quot;
            &lt;/span&gt;&lt;span style="color: blue"&gt;End If
            &lt;/span&gt;_Shipper = value
        &lt;span style="color: blue"&gt;End Set
    End Property

    Private &lt;/span&gt;_details &lt;span style="color: blue"&gt;As New &lt;/span&gt;List(&lt;span style="color: blue"&gt;Of &lt;/span&gt;Detail)
    &lt;span style="color: blue"&gt;Public ReadOnly Property &lt;/span&gt;Details() &lt;span style="color: blue"&gt;As &lt;/span&gt;List(&lt;span style="color: blue"&gt;Of &lt;/span&gt;Detail)
        &lt;span style="color: blue"&gt;Get
            Return &lt;/span&gt;_details
        &lt;span style="color: blue"&gt;End Get
    End Property

    Public Class &lt;/span&gt;Detail
        &lt;span style="color: blue"&gt;Sub New&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;productName &lt;span style="color: blue"&gt;As String&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;quantity &lt;span style="color: blue"&gt;As Short&lt;/span&gt;)
            _ProductName = productName
            _Quantity = quantity
        &lt;span style="color: blue"&gt;End Sub

        Private &lt;/span&gt;_ProductName &lt;span style="color: blue"&gt;As String
        Public Property &lt;/span&gt;ProductName() &lt;span style="color: blue"&gt;As String
            Get
                Return &lt;/span&gt;_ProductName
            &lt;span style="color: blue"&gt;End Get
            Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As String&lt;/span&gt;)
                _ProductName = value
            &lt;span style="color: blue"&gt;End Set
        End Property

        Private &lt;/span&gt;_Quantity &lt;span style="color: blue"&gt;As Short
        Public Property &lt;/span&gt;Quantity() &lt;span style="color: blue"&gt;As Short
            Get
                Return &lt;/span&gt;_Quantity
            &lt;span style="color: blue"&gt;End Get
            Set&lt;/span&gt;(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;value &lt;span style="color: blue"&gt;As Short&lt;/span&gt;)
                _Quantity = value
            &lt;span style="color: blue"&gt;End Set
        End Property
    End Class
End Class&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Next, let's add a schema for the OrderEntry XML data that is contained in the document. This will give us &lt;a href="http://msdn.microsoft.com/en-us/library/bb531325.aspx" target="_blank"&gt;IntelliSense on our XML&lt;/a&gt; when we're using LINQ to XML. We can just open the document in Visual Studio like before and copy the OrderEntry XML data into the clipboard. Then we can Add a new &lt;a href="http://msdn.microsoft.com/en-us/library/cc442691.aspx" target="_blank"&gt;XML to Schema&lt;/a&gt; Item and paste into the Wizard's dialog box. This will infer the schema and place the XSD file into the project automatically for us. Notice that I specified a namespace on our OrderEntry XML data. We now can import this namespace into our main program along with a few other .NET namespaces we'll need:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;'Reference to our data service and data entities:
&lt;/span&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;NorthwindOrderDocParser.NorthwindService
&lt;span style="color: green"&gt;'Open XML SDK:
&lt;/span&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;DocumentFormat.OpenXml.Packaging
&lt;span style="color: blue"&gt;Imports &lt;/span&gt;System.IO
&lt;span style="color: green"&gt;'Default XML Namespace:
&lt;/span&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #b96464"&gt;xmlns&lt;/span&gt;&lt;span style="color: #6464b9"&gt;=&lt;/span&gt;&lt;span style="color: #555555"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #6464b9"&gt;urn:microsoft:examples:oba&lt;/span&gt;&lt;span style="color: #555555"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;We are almost ready to start writing our main program to parse the purchase order. First we need a test document. For this test I filled out the following information in a document called MyTestOrder.docx.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc5_2.jpg"&gt;&lt;img height="540" alt="wordcc5" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc5_thumb.jpg" width="654" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Now we can write our main program:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Module &lt;/span&gt;Module1

    &lt;span style="color: blue"&gt;Sub &lt;/span&gt;Main()
        &lt;span style="color: blue"&gt;Try
            Dim &lt;/span&gt;docFile = &lt;span style="color: blue"&gt;My&lt;/span&gt;.Computer.FileSystem.GetFileInfo(&lt;span style="color: #a31515"&gt;&amp;quot;MyTestOrder.docx&amp;quot;&lt;/span&gt;)

            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;docData &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData
            &lt;span style="color: blue"&gt;Using &lt;/span&gt;sr = docFile.OpenRead()
                &lt;span style="color: green"&gt;'Attempt to parse the document for order data
                &lt;/span&gt;docData = ParseOrderDocument(sr)
                sr.Close()
            &lt;span style="color: blue"&gt;End Using

            If &lt;/span&gt;docData &lt;span style="color: blue"&gt;IsNot Nothing Then
                Dim &lt;/span&gt;employeeEmail = &lt;span style="color: #a31515"&gt;&amp;quot;sales@nwtraders.com&amp;quot;

                &lt;/span&gt;&lt;span style="color: green"&gt;'Attempt to add the order data through the service
                &lt;/span&gt;AddNewOrder(docData, employeeEmail)
                Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Order saved successfully.&amp;quot;&lt;/span&gt;)
            &lt;span style="color: blue"&gt;Else
                &lt;/span&gt;Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;No order data was found in the document.&amp;quot;&lt;/span&gt;)
            &lt;span style="color: blue"&gt;End If

        Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
            Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Order could not be processed.&amp;quot; &lt;/span&gt;&amp;amp; vbCrLf &amp;amp; ex.ToString())
        &lt;span style="color: blue"&gt;End Try

        &lt;/span&gt;Console.ReadLine()
    &lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;The ParseOrderDocument method is going to need to grab the XML data from our Custom XML parts as we iterate over the part collection. It's a collection because there can actually be many Custom XML definitions in our document. In order to make grabbing the XML data from the parts easier let's create an &lt;a href="http://msdn.microsoft.com/en-us/library/bb384936.aspx" target="_blank"&gt;Extension method&lt;/a&gt; that extends the OpenXMLPart type. I like to place Extension methods in a separate file called Extensions.vb:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Imports &lt;/span&gt;DocumentFormat.OpenXml.Packaging
&lt;span style="color: blue"&gt;Imports &lt;/span&gt;System.IO
&lt;span style="color: blue"&gt;Imports &lt;/span&gt;System.Xml

&lt;span style="color: blue"&gt;Module &lt;/span&gt;Extensions

    &lt;span style="color: green"&gt;' Create an extension method so we can easily access the part XML
    &lt;/span&gt;&amp;lt;System.Runtime.CompilerServices.Extension()&amp;gt; _
    &lt;span style="color: blue"&gt;Function &lt;/span&gt;GetXDocument(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;part &lt;span style="color: blue"&gt;As &lt;/span&gt;OpenXmlPart) &lt;span style="color: blue"&gt;As &lt;/span&gt;XDocument
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;xdoc &lt;span style="color: blue"&gt;As &lt;/span&gt;XDocument

        &lt;span style="color: blue"&gt;Using &lt;/span&gt;sr &lt;span style="color: blue"&gt;As New &lt;/span&gt;StreamReader(part.GetStream())
            xdoc = XDocument.Load(XmlReader.Create(sr))
            sr.Close()
        &lt;span style="color: blue"&gt;End Using

        Return &lt;/span&gt;xdoc
    &lt;span style="color: blue"&gt;End Function
End Module&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Now we can go back to our main Module1 and add a the ParseOrderDocument method. Notice that I'm using the Extension method we created in the For Each part... loop to return the custom XML as an XDocument. Then I use the child axis property &amp;lt;OrderEntry&amp;gt; (displayed in IntelliSense as I type the query) to see if the element exists. Also notice that since I imported our XML namespace at the top of the file it will only return an &amp;lt;OrderEntry&amp;gt; element in that namespace. So we're safe not to clash with other custom XML that may be added to the document by other processes.&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' Attempts to parse the word document for order data and returns an order
'''  object with all the required. The document must have a customXML part 
'''  that adheres to the OrderEntry.xsd
''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;docStream&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;The document to parse&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;The order data contained in the document&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;
&lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;Function &lt;/span&gt;ParseOrderDocument(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;docStream &lt;span style="color: blue"&gt;As &lt;/span&gt;Stream) &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData
    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;orderData &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData = &lt;span style="color: blue"&gt;Nothing

    Try
        &lt;/span&gt;&lt;span style="color: green"&gt;'Use the Open XML SDK to open the document and access parts easily
        &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;wordDoc = WordprocessingDocument.Open(docStream, &lt;span style="color: blue"&gt;False&lt;/span&gt;)

        &lt;span style="color: blue"&gt;Using &lt;/span&gt;wordDoc
            &lt;span style="color: green"&gt;'Get the main document part (document.xml)
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;mainPart = wordDoc.MainDocumentPart
            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;docXML &lt;span style="color: blue"&gt;As &lt;/span&gt;XElement = &lt;span style="color: blue"&gt;Nothing

            &lt;/span&gt;&lt;span style="color: green"&gt;'Find the order data custom XML part
            &lt;/span&gt;&lt;span style="color: blue"&gt;For Each &lt;/span&gt;part &lt;span style="color: blue"&gt;In &lt;/span&gt;mainPart.CustomXmlParts
                docXML = part.GetXDocument.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;OrderEntry&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.FirstOrDefault()
                &lt;span style="color: blue"&gt;If &lt;/span&gt;docXML &lt;span style="color: blue"&gt;IsNot Nothing Then
                    Exit For
                End If
            Next

            If &lt;/span&gt;docXML &lt;span style="color: blue"&gt;Is Nothing Then
                Throw New &lt;/span&gt;InvalidOperationException(&lt;span style="color: #a31515"&gt;&amp;quot;This document does not contain order entry data.&amp;quot;&lt;/span&gt;)
            &lt;span style="color: blue"&gt;End If

            &lt;/span&gt;&lt;span style="color: green"&gt;'Grab the order data fields from the XML 
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;customerID = docXML.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;CustomerID&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.Value.Trim()
            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;orderDate = docXML.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;OrderDate&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.Value.Trim()
            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;shipper = docXML.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;Shipper&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.Value.Trim()

            &lt;span style="color: blue"&gt;If &lt;/span&gt;customerID &amp;lt;&amp;gt; &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt;AndAlso &lt;/span&gt;IsDate(orderDate) &lt;span style="color: blue"&gt;Then
                &lt;/span&gt;&lt;span style="color: green"&gt;'Create and fill the DocumentOrderData  
                &lt;/span&gt;orderData = &lt;span style="color: blue"&gt;New &lt;/span&gt;DocumentOrderData(customerID, &lt;span style="color: blue"&gt;CDate&lt;/span&gt;(orderDate), shipper)

                &lt;span style="color: blue"&gt;For Each &lt;/span&gt;item &lt;span style="color: blue"&gt;In &lt;/span&gt;docXML.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;OrderDetails&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;OrderDetail&lt;span style="color: #6464b9"&gt;&amp;gt;
                    &lt;/span&gt;&lt;span style="color: green"&gt;'Grab order details data fields
                    &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;product = item.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;ProductName&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.Value.Trim()
                    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;quantity = item.&lt;span style="color: #6464b9"&gt;&amp;lt;&lt;/span&gt;Quantity&lt;span style="color: #6464b9"&gt;&amp;gt;&lt;/span&gt;.Value.Trim()

                    &lt;span style="color: blue"&gt;If &lt;/span&gt;product &amp;lt;&amp;gt; &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot; &lt;/span&gt;&lt;span style="color: blue"&gt;AndAlso &lt;/span&gt;IsNumeric(quantity) &lt;span style="color: blue"&gt;Then
                        &lt;/span&gt;&lt;span style="color: green"&gt;'Add a new DocumentOrderData.Detail for each product found
                        &lt;/span&gt;orderData.Details.Add(&lt;span style="color: blue"&gt;New &lt;/span&gt;DocumentOrderData.Detail(product, &lt;span style="color: blue"&gt;CShort&lt;/span&gt;(quantity)))
                    &lt;span style="color: blue"&gt;End If

                Next
            End If
            &lt;/span&gt;wordDoc.Close()
        &lt;span style="color: blue"&gt;End Using

    Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
        &lt;span style="color: blue"&gt;Throw New &lt;/span&gt;InvalidOperationException(&lt;span style="color: #a31515"&gt;&amp;quot;Could not process this document.&amp;quot;&lt;/span&gt;, ex)
    &lt;span style="color: blue"&gt;End Try

    Return &lt;/span&gt;orderData
&lt;span style="color: blue"&gt;End Function&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Updating the Database through the Data Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we have our document parsed we're just left with adding the data through our data service.&amp;#160; What we need to do is query the reference data (entities) that we'll need to properly associate on our Order. For instance Order will need a reference to the Customer, the Employee and the Shipper. Then each Order_Detail will need a reference to the Product entity. Notice that we're passing the employee email address into this method so that we can associate the sales rep with the order. &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/03/oba-part-1-exposing-line-of-business-data.aspx" target="_blank"&gt;If you recall we had to add this field&lt;/a&gt; to the Customer and Employee tables in Northwind. (For this test program I'm hard-coding the value but later we'll get this information from the Outlook client when it submits the order to SharePoint.)&lt;/p&gt;

&lt;p&gt;Once we have these entities queried and returned from the service we can link them up properly and add our new Order and Order_Details to the data service. For more information on updating data and setting proper linkage to entities returned from an ADO.NET data service &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/01/20/ado-net-data-services-enforcing-fk-associations-and-a-fix-for-deleting-entities.aspx" target="_blank"&gt;read this post&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/phaniraj/archive/2008/07/02/working-with-relations-in-ado-net-data-services-beta-1.aspx" target="_blank"&gt;this one&lt;/a&gt;. &lt;/p&gt;

&lt;pre class="code"&gt;    &lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: green"&gt;''' Adds a new order through the ADO.NET Data service and sets up all the required
    ''' associations to related entities.
    ''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;
    &lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;docData&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;The order data&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
    &lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;employeeEmail&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;EmailAddress of sales representitve&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
    &lt;/span&gt;&lt;span style="color: green"&gt;''' &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;
    &lt;/span&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;AddNewOrder(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;docData &lt;span style="color: blue"&gt;As &lt;/span&gt;DocumentOrderData, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;employeeEmail &lt;span style="color: blue"&gt;As String&lt;/span&gt;)

        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;ctx &lt;span style="color: blue"&gt;As New &lt;/span&gt;NorthwindEntities(&lt;span style="color: blue"&gt;New &lt;/span&gt;Uri(&lt;span style="color: #a31515"&gt;&amp;quot;http://localhost:1234/Northwind.svc/&amp;quot;&lt;/span&gt;))
      &lt;span style="color: blue"&gt;  Dim &lt;/span&gt;cust &lt;span style="color: blue"&gt;As &lt;/span&gt;Customer
        &lt;span style="color: blue"&gt;Try
            &lt;/span&gt;&lt;span style="color: green"&gt;'Try to retrieve the customer
            &lt;/span&gt;cust = (&lt;span style="color: blue"&gt;From &lt;/span&gt;c &lt;span style="color: blue"&gt;In &lt;/span&gt;ctx.Customers _
                     &lt;span style="color: blue"&gt;Where &lt;/span&gt;c.CustomerID = docData.CustomerID).FirstOrDefault()

        &lt;span style="color: blue"&gt;Catch &lt;/span&gt;ex &lt;span style="color: blue"&gt;As &lt;/span&gt;Exception
            &lt;span style="color: blue"&gt;Throw New &lt;/span&gt;InvalidOperationException(&lt;span style="color: #a31515"&gt;&amp;quot;Invalid customer ID.&amp;quot;&lt;/span&gt;)&lt;span style="color: blue"&gt;
        End Try

        If &lt;/span&gt;cust &lt;span style="color: blue"&gt;IsNot Nothing Then

            Dim &lt;/span&gt;ship = (&lt;span style="color: blue"&gt;From &lt;/span&gt;s &lt;span style="color: blue"&gt;In &lt;/span&gt;ctx.Shippers _
                        &lt;span style="color: blue"&gt;Where &lt;/span&gt;s.CompanyName = docData.Shipper).FirstOrDefault()

            &lt;span style="color: green"&gt;'Email Address will come from our Outlook client/sales person 
            &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;emp = (&lt;span style="color: blue"&gt;From &lt;/span&gt;e &lt;span style="color: blue"&gt;In &lt;/span&gt;ctx.Employees _
                       &lt;span style="color: blue"&gt;Where &lt;/span&gt;e.EmailAddress = employeeEmail).FirstOrDefault()

            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;o &lt;span style="color: blue"&gt;As New &lt;/span&gt;Order()

            o.OrderDate = docData.OrderDate
            o.RequiredDate = Now.AddDays(2)
            o.ShipAddress = cust.Address
            o.ShipCity = cust.City
            o.ShipCountry = cust.Country
            o.ShipName = cust.ContactName
            o.ShipPostalCode = cust.PostalCode
            o.ShipRegion = cust.Region
            o.Freight = 25

            ctx.AddToOrders(o)

            o.Customer = cust
            ctx.SetLink(o, &lt;span style="color: #a31515"&gt;&amp;quot;Customer&amp;quot;&lt;/span&gt;, cust)

            &lt;span style="color: blue"&gt;If &lt;/span&gt;ship &lt;span style="color: blue"&gt;IsNot Nothing Then
                &lt;/span&gt;o.Shipper = ship
                ctx.SetLink(o, &lt;span style="color: #a31515"&gt;&amp;quot;Shipper&amp;quot;&lt;/span&gt;, ship)
            &lt;span style="color: blue"&gt;End If

            If &lt;/span&gt;emp &lt;span style="color: blue"&gt;IsNot Nothing Then
                &lt;/span&gt;o.Employee = emp
                ctx.SetLink(o, &lt;span style="color: #a31515"&gt;&amp;quot;Employee&amp;quot;&lt;/span&gt;, emp)
            &lt;span style="color: blue"&gt;End If

            &lt;/span&gt;o.Order_Details = &lt;span style="color: blue"&gt;New &lt;/span&gt;System.Collections.ObjectModel.Collection(&lt;span style="color: blue"&gt;Of &lt;/span&gt;Order_Detail)

            &lt;span style="color: blue"&gt;For Each &lt;/span&gt;item &lt;span style="color: blue"&gt;In &lt;/span&gt;docData.Details
                &lt;span style="color: blue"&gt;Dim &lt;/span&gt;productName = item.ProductName.ToLower()
                &lt;span style="color: blue"&gt;Dim &lt;/span&gt;product = (&lt;span style="color: blue"&gt;From &lt;/span&gt;p &lt;span style="color: blue"&gt;In &lt;/span&gt;ctx.Products _
                               &lt;span style="color: blue"&gt;Where &lt;/span&gt;p.ProductName.ToLower() = productName).FirstOrDefault()

                &lt;span style="color: blue"&gt;If &lt;/span&gt;product &lt;span style="color: blue"&gt;IsNot Nothing Then
                    &lt;/span&gt;&lt;span style="color: green"&gt;'Create a detail for each product being ordered
                    &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;detail &lt;span style="color: blue"&gt;As New &lt;/span&gt;Order_Detail()
                    o.Order_Details.Add(detail)

                    detail.Quantity = item.Quantity
                    detail.UnitPrice = &lt;span style="color: blue"&gt;If&lt;/span&gt;(product.UnitPrice.HasValue, _
                                          product.UnitPrice.Value, 1D)

                    ctx.AddToOrder_Details(detail)

                    detail.Product = product
                    ctx.SetLink(detail, &lt;span style="color: #a31515"&gt;&amp;quot;Product&amp;quot;&lt;/span&gt;, product)

                    detail.Order = o
                    ctx.SetLink(detail, &lt;span style="color: #a31515"&gt;&amp;quot;Order&amp;quot;&lt;/span&gt;, o)

                    ctx.AddLink(o, &lt;span style="color: #a31515"&gt;&amp;quot;Order_Details&amp;quot;&lt;/span&gt;, detail)
                &lt;span style="color: blue"&gt;End If
            Next
            &lt;/span&gt;&lt;span style="color: green"&gt;'Saving in Batch mode will update the data inside a database transaction
            'This will throw an exception if the service can't save the Order
            &lt;/span&gt;ctx.SaveChanges(Services.Client.SaveChangesOptions.Batch)
        &lt;span style="color: blue"&gt;End If
    End Sub
End Module&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;When we run this program we will see that Customer ALFKI now has a new Order and 4 Order Details entered into the database. Since we're sending the updates in Batch mode this will cause our order data to be properly wrapped in a database transaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc6_2.jpg"&gt;&lt;img height="509" alt="wordcc6" src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/OBAPart3ReadingDatafromWordDocuments_DE22/wordcc6_thumb.jpg" width="666" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Next post we'll talk about how we can create a SharePoint workflow to run this code when order documents are added to a SharePoint list. However, if SharePoint is not a requirement of your system (maybe you have no need to collaborate on documents or store this unstructured data) you could easily add this code directly to the &lt;a href="http://blogs.msdn.com/bethmassi/archive/2009/02/07/oba-part-2-building-and-outlook-client-against-lob-data.aspx" target="_blank"&gt;Outlook client we built in the previous post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I updated &lt;a href="http://code.msdn.microsoft.com/OBANorthwind" target="_blank"&gt;the sample on Code Gallery&lt;/a&gt; with this project so have a look. &lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9416665" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Article/default.aspx">Article</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/XML/default.aspx">XML</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Office/default.aspx">Office</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Data/default.aspx">Data</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/OBA/default.aspx">OBA</category></item><item><title>Building an Office Business Application for TechReady 8</title><link>http://blogs.msdn.com/bethmassi/archive/2009/02/02/building-an-office-business-application-for-techready-8.aspx</link><pubDate>Tue, 03 Feb 2009 03:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9392479</guid><dc:creator>Beth Massi</dc:creator><slash:comments>18</slash:comments><comments>http://blogs.msdn.com/bethmassi/comments/9392479.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bethmassi/commentrss.aspx?PostID=9392479</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bethmassi/rsscomments.aspx?PostID=9392479</wfw:comment><description>&lt;P&gt;The last week I've been working with a couple teammates on an Office Business Application (OBA) demonstration we wanted to put together for TechReady 8. TechReady is an internal conference we deliver to the field employees. It's my first one and so far it's been pretty fun. This morning Scott Hanselman hosted an "UnKeynote" that showcased a lot of the new stuff coming in Visual Studio 2010 that I can't talk about yet but believe me it was cool. ;-)&lt;/P&gt;
&lt;P&gt;The application I helped build with Rachel and Mike on my team was a total blast. We wanted to demonstrate using Office as a client to Line-of-Business data as well as show some of the nifty features of SharePoint workflows. So we decided it was time to bring poor Northwind Traders into the 21st century. Here's what we came up with:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/BuildinganOfficeBusinessApplicationforTe_CD9B/OBANorthwind_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/BuildinganOfficeBusinessApplicationforTe_CD9B/OBANorthwind_2.jpg"&gt;&lt;IMG border=0 alt=OBANorthwind src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/BuildinganOfficeBusinessApplicationforTe_CD9B/OBANorthwind_thumb.jpg" width=683 height=484 mce_src="http://blogs.msdn.com/blogfiles/bethmassi/WindowsLiveWriter/BuildinganOfficeBusinessApplicationforTe_CD9B/OBANorthwind_thumb.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;We needed a way to easily and securely expose our LOB data -- the Northwind database -- to the enterprise. So we created an entity data model against our SQL Server Northwind database and then exposed it using &lt;A href="http://blogs.msdn.com/bethmassi/archive/2009/01/09/using-ado-net-data-services.aspx" target=_blank mce_href="http://blogs.msdn.com/bethmassi/archive/2009/01/09/using-ado-net-data-services.aspx"&gt;ADO.NET Data Services&lt;/A&gt; . The Northwind sales reps do all of their work in Outlook, communicating with our high-volume customers. So we built an Outlook Add-in that they can use to look up the customer order history from the database and easily work with purchase orders. The Add-in displays a form region with the customer order history in an adjoining area below when they open the email. &lt;/P&gt;
&lt;P&gt;The orders are then submitted to a SharePoint document library as Word 2007 documents with XML data specified via content controls. A SharePoint Workflow then shreds this document data (using VB XML literals support and the Open XML SDK) and passes it to the ADO.NET data Service which persists the data in the database. This was written as a SharePoint sequential workflow.&lt;/P&gt;
&lt;P&gt;We also built an Excel client for our shipping department to use that displays the orders that are ready to ship which allows them to update the ship date and save it back to through the data service. It also shows the products and quantities ordered in an Action Pane and does some data analysis using a pivot table and pie chart to show the breakdown of shipping cities and freight cost. We also used WPF user controls in the Outlook and Excel clients so that we could match the look-and-feel of Office. &lt;/P&gt;
&lt;P&gt;Finally we created a web part for the SharePoint site that displays key performance indicators like oversold products and our top customer sales.&lt;/P&gt;
&lt;P&gt;I have to say it was a very fun project to work on and I personally learned a lot about Excel and WPF as well as the OBA architecture. We spend about 3 days building this and I was pleasantly surprised how well the tools worked together. The pieces we built were predominantly in Visual Studio 2008 by Rachel and I and Mike handled the bleeding edge SharePoint parts.&lt;/P&gt;
&lt;P&gt;In the next few blog posts I'll go into the details of building WPF user controls in the Excel and Outlook clients and how we exposed a simple, clean data model against the not-so-clean Northwind database. I'll also show the technique of how we easily stripped the order data out of the Word 2007 documents. &lt;/P&gt;
&lt;P&gt;For now, some good links on OBA and VSTO development:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://msdn.microsoft.com/en-us/vsto/dd164303.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vsto/dd164303.aspx"&gt;Office Development Videos&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://msdn.com/vsto" target=_blank mce_href="http://msdn.com/vsto"&gt;Office Development with Visual Studio&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/bethmassi/archive/2009/01/22/ado-net-data-services-building-an-excel-client.aspx" target=_blank mce_href="http://blogs.msdn.com/bethmassi/archive/2009/01/22/ado-net-data-services-building-an-excel-client.aspx"&gt;ADO.NET Data Services - Building an Excel Client&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/vsto/" target=_blank mce_href="http://blogs.msdn.com/vsto/"&gt;Office Development with Visual Studio Team Blog&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Until next time....&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;&amp;nbsp;- Here is the full set of articles and code: &lt;A href="http://code.msdn.microsoft.com/OBANorthwind"&gt;http://code.msdn.microsoft.com/OBANorthwind&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9392479" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/DevCenter/default.aspx">DevCenter</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Office/default.aspx">Office</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/Data/default.aspx">Data</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VS2010/default.aspx">VS2010</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://blogs.msdn.com/bethmassi/archive/tags/OBA/default.aspx">OBA</category></item></channel></rss>