Use LINQ in SharePoint

Source: Internet
Author: User

Using LINQLINQ in SharePoint is an effective and efficient way to query data. With SPMetal, you can prepare a SharePoint list for LINQ. The following describes how to prepare your list and create an application using LINQ. 1. Open the command line (run as administrator ). 2. navigate to c: \ Program Files \ Common Files \ Microsoft Shared \ web server extensions \ 14 \ binand enter the following command (ensure that your server name is replaced by your spmetal.exe/web: http: // <servername>/code: SPEntityModel. cs/language: csharp
3. The SPMetal command tool will create the C # file SPEntityModel. cs. You can use it to execute the LINQ query on the SharePoint list model in an application (SPMetal mainly translates all the lists in the site into Entity models ). 4. Enable VS as an administrator. 5. Create a blank SharePoint project MyFirstSPLinqProject, click OK, and deploy the project as a field solution. 6. Right-click the project to add an existing item and find the created SPEntityModel. cs. 7. Right-click the project to add a new item, select Web Part, and name it MySPLinqWebPart. Click Add. 8. Right-click reference and select Add reference. Click Browse and navigate to the c: \ Program Files \ Common Files \ Microsoft Shared \ web server extensions \ 14 \ ISAPI. select Microsoft. SharePoint. Linq. dll and click OK. 9. Right-click MySPLinqWebPart. cs to view the code. 10. modify code: 11. Modify the. webpart file code: 12. Deploy the solution after completion. 13. Add this Web Part. 14. Click Get Lists to obtain the target customers and types of the list. Local Machine:
PS: This article and the previous blog posts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.