Create a list for SharePoint and use the Windows Presentation Foundation application to manage the list

Source: Internet
Author: User

Creating a list in SharePoint and using the program management list is one of the ways for SharePoint developers to input data. Use the Web interface to create a list and add data as follows: 1. Open the site. 2. Click All website content. 3. Click create. 4. Select the custom list, name MERs, and enter the description. Select and click Create in the Quick Start navigation bar. This creates a custom list. Next, we will add three columns: Region/Size/Sales. 1. Click the create button in the functional area to name Region and select the option type. Add four options: East/West/North/South. For other default values, click OK. 2. Add the Size column and the "option" type: Small/Medium/Enterprise. Click "OK. 3. Add the Sales column, select a single line of text, and click OK. 4. Finally, click the function area list settings, click the Title link, change the default Title to Name, and click OK. 5. Although you have changed the Title to Name, you still need to use the Title during programming. Place the cursor over the Name Field and check the Field = Title of the URL.
6. Add some projects to the list. Click Customers list, and click Add new project. Complete the following results.
You can program the list in SharePoint 2010 so that you can manage/create/read/update/delete (CRUD) operations. 1. Open VS 2010 as an administrator. Create a new project WPF application. 2. Name WPFSPListAPP. Click OK. Right-click the MainWindow. xaml file and select the view designer. 3. Add 5 labels, 4 text boxes, and 3 buttons.
Below are some Name attributes
5. Right-click MainWindwow. xaml to view the code. 6. Right-click reference, click Add service reference, click Advanced, and click Add Web reference. 7. In the Add Web reference dialog box, click the Web service link of the local computer.
8. Select the Lists Web service, such as http: // <server name>/_ vti_bin/Lists. asmx. You need to change to your server name. Provide a name and click "add reference.
9. Now you can add an event processor for each button. The Update button is used to connect the Web service to SharePoint. You also need a series of class-level variables to get user input and pass it to Lists Web service. When you call Lists Web service, you also need to create XML to pass data from wpf to the SharePoint list. XML is called Collaborative Application Markup Language (CAML ). You need to update the MainWindow. xaml code: 10. F5 debugging. Click Update.
11. view the list.
In this example, you use Lists Web service, which provides many ways to communicate with the list-for example, adding/deleting a list, adding an attachment, and obtaining a list. In this example, you use the GetListAndView method. In this call, you pass the list name Customers and map the returned value to an XMLNode object. XmlNode myListView = myListService. GetListAndView ("MERs", "");
This example also uses CAML to insert data to the SharePoint list. I have to say that CAML is lengthy and wordy.
Finally, the key UpdateListItems method is used to pass in the list ID and list architecture. XmlNode myListReturn = myListService. UpdateListItems (strListID, batchXML );
This method uses native Web services, which has advantages and disadvantages. Advantages include ease of use and research of existing services, otherwise you need to create your own; disadvantages include potential service integration performance and lengthy complexity of the CAML syntax.

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.