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!