Scenario:
Sharepoint is relatively big product and lot of small small things can make the developers productive. Here's a small tip to easily generate the entities for LINQ to SharePoint.
Steps:
1. Look for SPMetal locally.
2. Open Visual Studio
3. Go to Tools > External Tools > Add a new tool with below settings
Setting:
Title : SPMetalNow just go to Tools > SPMetal , once it runs you will see a new file in the project directory , include it in the project and use it.
Command : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Bin\SPMetal.exe <-- ( This is default location where SPMetal is installed )
Arguments : /web:http://intranet.contoso.com /namespace:SKN.Samples /code:TeamSiteDataContext.cs
Use Output Window : Checked
Output as Unicode : Unchecked
Initial Directory : $(ProjectDir)
Recommended:
SPMetal generates code for all the list / libraries and so its better to start with Blank Site and add required list / libraries to it and then run SPMetal.
Article:
How to: Use SPMetal , SPMetal
0 comments:
Post a Comment