In my blog post, MSDN Webcast: Creating Microsoft Office 2010 Add-Ins Using SharePoint 2010 as a Data Source, I pointed you to the webcast discussing how to create Office add-ins that leverage SharePoint 2010 data. But here I’m pleased to announce the July, 2010 MSDN article, Office Add-Ins: 3 Solutions for Accessing SharePoint Data in Office 2010, that Paul Stubbs and I co-authored. This article provides prescriptive guidance on how to build add-ins that access SharePoint using three different approaches:
We discuss a few no-code solutions for landing SharePoint data in Office along the way as well.
Sample code for #1 and #2 is available here, http://code.msdn.microsoft.com/201007OfficeAddins.
To help you with setup, if you are using the SharePoint 2010 RTM VHD, you can go here, http://cid-a88aadb6e5827318.office.live.com/browse.aspx/.Public/MSDN%5E_2010%5E_July%5E_Article, and download a MSDN_Article_Setup_Files.zip file. This contains a PowerShell script to setup the SharePoint site on the VM.
Create the site:
Now that you have the site setup, to prepare to run the client object model add-in, you first need to create a database view of the CRM data you will be using and then create an External Content type in SharePoint designer and then the corresponding External List. I used the AdventureWorksLT database.
Create a Database view:
Create the External Content Type (ECT) for the database view:
Create a new External List:
To prepare for the WCF Data Services example, you need to deploy the solution that creates the Course and Course Category lists and establishes the relationship between them. You can then make up your own course/course category data for testing.
Create the Course/Course Category lists and load the data:
All in all, this should get you rolling with landing SharePoint 2010 data in Office! Be sure to follow Paul’s blog for the guidance he has on the Outlook add-in that uses the UserProfileService web service.
A special thanks to John Durant for reviewing and adding his touch to the article.