MOSS SDKѧϰ(5)
MOSS SDKѧϰ(5)
ºÍWSS2.0Ïà±È£¬ÎÒ¾õµÃWSS3.0ÔÚʼþ·½ÃæÓÐÁ½¸ö×îÖ÷ÒªµÄ¸Ä½ø£º
1¡¢ WSS2.0ÖеÄʼþÖ»ÄÜÔÚʼþÒѾ·¢Éú¹ý´¥·¢£¬¶øWSS3.0¿ÉÒÔÔÚʼþ·¢Éúǰ´¥·¢£¬±ÈÈçÔÚÓû§É¾³ýÒ»¸öÎļþʱ´¥·¢À´×èÖ¹Óû§É¾³ýÎļþ
2¡¢ WSS2.0ÖеÄʼþÖ»Äܸ½¼ÓÔÚÎĵµ¿âÖУ¬¶øWSS3.0µÄʼþ¿ÉÒÔ¸½¼ÓÔÚÍøÕ¾¡¢Áбí(°üÀ¨Îĵµ¿â)¡¢ÎļþÉÏ
Õâ¸öÀý×ÓÖ÷ÒªÑÝʾµÄÊÇWSSÖÐ×î¼òµ¥µÄʼþ²Ù×÷ºÍ²¿Êð¡£
Ê×ÏÈÎÒÃDZàдһ¸ö×î¼òµ¥µÄʼþ´¦Àí³ÌÐò£º
´úÂëÈçÏ£º
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace SimpleEventHandler

{
public class SimpleEventHandler : SPItemEventReceiver
{
public override void ItemUpdating(SPItemEventProperties properties)
{
properties.Cancel = true;
properties.ErrorMessage = "Updating is not supported.";
}
public override void ItemAdded(SPItemEventProperties properties)
{
properties.AfterProperties["Body"] = "Body text maintained by the system.";
}
}
}
ʼþ´¦Àí³ÌÐòдºÃÖ®ºóÒª°ÑËü²¿Êðµ½MOSSÖÐÈ¥£¬ÓÐÈýÖÖ²¿Êð·½Ê½£º
1¡¢ ͨ¹ýSPWeb »ò SPListµÄÊôÐÔEventReceiversµÄAdd·½·¨
2¡¢ ÉùÃ÷ÁбíÀàÐÍ£¬Ê¹ÓÃFeature.xml£¬×¢²á³ÉÒ»¸öFeature£¬¿ÉÒÔÔÚÍøÕ¾ÄڶദʹÓÃ
3¡¢ ÉùÃ÷ÄÚÈÝÀàÐÍ£¬¿ÉÒÔ×öΪÄÚÈÝÀàÐ͵ÄÒ»²¿·ÖÀ´Ê¹ÓÃ
ÕâÀïÎÒʹÓÃFeatureµÄ·½Ê½À´²¿Ê𣬲½ÖèÈçÏ£º
1¡¢ ÔÚC:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/FEATURES Ͻ¨Ò»¸öĿ¼EventFeature
2¡¢ ÔÚÕâ¸öĿ¼ÏÂн¨Ò»¸öÎļþ Feature.xml
<Feature Scope="Web"
Title="²âÊÔʼþ"
Id="C6458ADE-F5BB-498d-BB64-2E4FB19E08FB"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
ÆäÖеÄidÖµ¿ÉÒÔʹÓÃVS2005¹¤¾ßµÄ´´½¨GUIDÉú³É
3¡¢ ÔÚÕâ¸öĿ¼ÏÂн¨Ò»¸öÎļþelements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Receivers ListTemplateId="104">
<Receiver>
<Name>SimpleEvent</Name>
<Type>ItemUpdating</Type>
<SequenceNumber>10000</SequenceNumber>
<Assembly>SimpleEventHandler, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=99352c476b7ca41e</Assembly>
<Class>SimpleEventHandler.SimpleEventHandler</Class>
<Data></Data>
<Filter></Filter>
</Receiver>
</Receivers>
</Elements>
ÆäÖеÄPublicKeyTokenÓ¦¸ÃºÍdllÖеÄÒ»Ö£¬Ê¹ÓÃsn –T SimpleEventHandler.dll ÃüÁîÈ¡µÃ£¬
ListTemplateId="104" ´ú±íµÄÊÇ֪ͨÁбí
Õª³WSS3.0 SDKÖеIJ»Í¬ÁбíÀàÐ͵ĶÔÓ¦Öµ:
|
Value |
Description |
|
100 |
Generic list |
|
101 |
Document library |
|
102 |
Survey |
|
103 |
Links list |
|
104 |
Announcements list |
|
105 |
Contacts list |
|
106 |
Events list |
|
107 |
Tasks list |
|
108 |
Discussion board |
|
109 |
Picture library |
|
110 |
Data sources |
|
111 |
Site template gallery |
|
113 |
Web Part gallery |
|
114 |
List template gallery |
|
115 |
XML Form library |
|
117 |
No-code workflow library |
|
118 |
Workflow process list |
|
119 |
Web page library |
|
120 |
Custom grid for a list |
|
130 |
Data connection library |
|
140 |
Workflow history list |
|
150 |
Gantt tasks list |
|
200 |
Meeting Series list |
|
201 |
Meeting Agenda list |
|
202 |
Meeting Attendees list |
|
204 |
Meeting Decisions list |
|
207 |
Meeting Objectives list |
|
210 |
Meeting text box |
|
211 |
Meeting Things To Bring list |
|
212 |
Meeting Workspace Pages list |
|
300 |
Portal Sites list. |
|
1100 |
Issue tracking |
|
2002 |
Personal document library |
|
2003 |
Private document library |
4¡¢ ½«dllÎļþ²¿Êðµ½GACÖÐ
Gacutil –I SimpleEventHandler.dll
5¡¢ ½«Feature·¢²¼µ½ÍøÕ¾
stsadm -o installfeature -filename EventFeature\feature.xml
stsadm -o activatefeature -filename EventFeature\feature.xml -url http://localhost:999/Docs
iisreset
²¿ÊðºÃÖ®ºó»á×÷ÎªÍøÕ¾¹¦ÄÜÏÔʾÔÚÍøÕ¾¹¦ÄÜÒ»ÀÀÖÐ
Ö®ºóÎÒÃÇÔÚÎĵµÖÐÐĵÄ֪ͨÁбíÖмÓÈëÒ»¸ö֪ͨ£¬Ö®ºóµ±¸üÐÂʱ»á±§´í£º
²¿ÊðºÃÖ®ºó¾Í¿ÉÒÔÔÚMOSSÖÐʹÓÃÁË£¬Ê¹Ó÷½·¨ÈçÏ£º
1¡¢ÔÚMOSSµÄ¹ÜÀíÖÐϵÄWeb Ó¦ÓóÌÐò³£¹æÉèÖà ÉèÖà Ïòºó¼æÈݵÄʼþ´¦Àí³ÌÐòΪÆôÓÃ
2¡¢ÔÚÎĵµÁбíµÄÉèÖà –¡µ¸ß¼¶ÉèÖÃÖÐ Ìîд Ïòºó¼æÈݵÄʼþ´¦Àí³ÌÐò
ÕâÁ½²½ÔÚÎÒÃÇÕâ¸öÀý×ÓÖÐÓò»µ½£¬ÕâÁ½²½ÊÇÒÔǰWSS2.0µÄʼþ´¦Àí³ÌÐòµÄʹÓ÷½Ê½¡£
ÏÂÒ»¸öÀý×ÓÎÒ×¼±¸ÔÙдһ¸öÉÔ΢¸´ÔÓÒ»µãµÄʼþ³ÌÐò£¬È»ºóʹÓõÚÒ»ÖÖ·½Ê½²¿Êð¡£
