moss中的feature功能很强大,本文主要看一下如何开发一个模块化的feature。
比如可以把一个学生管理功能(包括aspx页面等)开发成一个feature,然后可以在不同的moss网站中有选择的激活这个feature,激活后就把对应的链接加入此网站的首页上,以此实现功能的动态加载。

为了方便说明,先列出我的文件结构:
Feature.dll
Install.bat
Template
            --Student
                          --elements.xml
                          --feature.xml
                          --Student
                                        --StudentList.aspx
                                        --UserEdit.aspx


首先我们在sharepoint designer中定制两个aspx页面:StudentList.aspx和UserEdit.aspx
(要保证这两个页面在moss站点中是能够正常访问的)
我这里只是演示feature的功能,就两个页面的代码就不列出了。

然后就是feature配置文件的写法
对于MOSS中的feature我们一般都要写两个配置文件:
其中ReceiverAssembly和ReceiverClass是指定feature激活等操作时对应的代码文件的,后面会提到
>
特别要注意的是我文件中的注释

然后就是Feature对应的Receiver代码
主要作用是在feature激活时把链接加到网站首页上,在停止时把feature对应的aspx页面从网站中删除(激活feature时会根据配置自动把文件复制到MOSS网站里)
在MOSS中开发一个模块化的feature    public class StudentFeature : SPFeatureReceiver
    }
代码没什么特殊的地方,就是使用了MOSS的object model进行操作

最后就是进行部署了
 1在MOSS中开发一个模块化的feature@SET TEMPLATEDIR="c:\program files\common files\microsoft shared\web server extensions\12\Template\Features"
 2在MOSS中开发一个模块化的feature@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm"
 3在MOSS中开发一个模块化的feature@SET GACUTIL="c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe"
 4在MOSS中开发一个模块化的feature
 5在MOSS中开发一个模块化的featureEcho Installing CustomSitePages.dll in GAC
 6在MOSS中开发一个模块化的feature%GACUTIL% -if Feature.dll
 7在MOSS中开发一个模块化的feature
 8在MOSS中开发一个模块化的featureEcho Copying files to TEMPLATE directory
 9在MOSS中开发一个模块化的featurexcopy //y TEMPLATE\* %TEMPLATEDIR%
10在MOSS中开发一个模块化的feature
11在MOSS中开发一个模块化的featureEcho Installing feature
12在MOSS中开发一个模块化的feature%STSADM% -o installfeature -filename  Student\feature.xml -force
13在MOSS中开发一个模块化的feature
14在MOSS中开发一个模块化的featureIISRESET
15在MOSS中开发一个模块化的featureREM cscript c:\windows\system32\iisapp.vbs /"SharePointDefaultAppPool" /r
16在MOSS中开发一个模块化的feature
17在MOSS中开发一个模块化的feature
第六行注册GAC
第九行复制文件
12行安装feature

安装好之后在需要的网站上激活这个feature就可以了

相关文章:

猜你喜欢
  • 2022-12-23
  • 2021-04-10
  • 2021-10-20
  • 2021-12-23
  • 2021-07-21
  • 2022-12-23
  • 2021-05-17
相关资源
相似解决方案