Web Part that SharePoint WebPart reads the contents of a list

Source: Internet
Author: User
Tags object model

Recently, I am also learning to write some SharePoint parts, that is, using the object model, below, introduce yourself just write the small test procedures, deficiencies, please correct me.

1. New Project

vs2008– New – Project – Class library – Enter name – OK, you can

2. Add Reference

Of course, many of the features are not my own writing, I need most of the call, especially for the operation of SharePoint itself, because there are object model AH. Right "Solution Explorer" reference, right-click to add Microsoft.SharePoint (this dongdong C:\Program Files\Common Files\Microsoft Shared\Web server Extensions\ 12\isapi below), because using the object model, this is definitely needed. And then add it to the previous using

Using Microsoft.SharePoint.WebPartPages;

Then add the following code in front of the public class Showlist:webpart so that the parameters we define can go where the widget is set on the right.

[ToolBoxData ("<{0}:wptoolpanetest runat=server></{0}:wptoolpanetest>"), XmlRoot (Namespace = " Wptoolpanetest ")]

Then add the enhanced name key

As shown in Figure 1

3, the following can be compiled to our parts, and then we can see, our parts can be posted to the SharePoint site?! First copy the DLL to the bin, then add the SafeControl string

<safecontrol assembly= "Showlist, version=1.0.0.0, Culture=neutral, publickeytoken=d6671b1a0bc0b78d" Namespace= " Showlist "typename=" * "safe=" True "/>

Again that publickeytoken how to find, you can use the Decompile tool, of course, you can also use VS2008 with the tool, VS2008 command prompt, input sn–t and then drag the DLL in, enter, remember-t after a space.

Release parts, I do not have to say it, I believe that we all know, do not know you find the parts we wrote did not, I was found, add in to see the problem wood has!

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.