Sharepoint中提供了定义Feature的功能,这样可以大大的增强了用户对Sharepoint中的功能的扩展。有人说Everything is feature on sharepoint。我感觉这句话说的一点也不为过,使用Sharepoint的自定义Feature功能可以把Sharepoint改的“面目全非”,开个玩笑。
介绍一个非常普遍的自定义Feature在“Upload”下添加一个自定义项
1.首先Sharepoint安装路径的“Features”文件夹下建立一个文件夹MyUploadDocument(名字随意)
2.在1文件夹下创建一个Feature.xml文件
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="6A8566B0-CD2E-441c-808B-0EA1A4D66F8D"
Title="My Upload Document"
Description="My Upload Document!"
Version="1.0.0.0"
Scope="Site"
AlwaysForceInstall="TRUE"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location=" MyUploadDocument.xml" />
</ElementManifests>
</Feature>
3.创建一个2中红色的文件“ MyUploadDocument.xml”这个就是你要添加的自定义Feature的文件。
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="MyUploadDocument"
RegistrationType="List"
RegistrationId="101"
GroupId="UploadMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
Title="My Upload Document"
Description="Upload a document from your computer to this library "
ImageUrl="/_layouts/images/UploadDoc.jpg">
<UrlAction Url=""/>
</CustomAction>
</Elements>
4.使用下面的bat脚本安装和激活Feature在Sharepoint中
@rem======================================================================
@rem
@rem setupfeature.bat
@rem
@rem======================================================================
@echo off
setlocal
pushd .
goto InstallFeature
@rem----------------------------------------------------------------------
@rem InstallFeature
@rem----------------------------------------------------------------------
:InstallFeature
set SPAdminTool=%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe
set TargetUrl=http://sharepoint-server:12345/sites/mysite001
set FeaturePath=MyUploadDocument\Feature.xml
echo InstallFeature %FeaturePath%
"%SPAdminTool%" -o installfeature -filename %FeaturePath%
echo Activating feature %FeaturePath%
"%SPAdminTool%" -o activatefeature -filename %FeaturePath% -url %TargetUrl%
echo iisreset
iisreset
5.以上就可以在你的Sharepoint站点的Shared Documents下添加这个自定义Feature了。
介绍一个非常普遍的自定义Feature在“Upload”下添加一个自定义项
1.首先Sharepoint安装路径的“Features”文件夹下建立一个文件夹MyUploadDocument(名字随意)
2.在1文件夹下创建一个Feature.xml文件
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="6A8566B0-CD2E-441c-808B-0EA1A4D66F8D"
Title="My Upload Document"
Description="My Upload Document!"
Version="1.0.0.0"
Scope="Site"
AlwaysForceInstall="TRUE"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location=" MyUploadDocument.xml" />
</ElementManifests>
</Feature>
3.创建一个2中红色的文件“ MyUploadDocument.xml”这个就是你要添加的自定义Feature的文件。
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="MyUploadDocument"
RegistrationType="List"
RegistrationId="101"
GroupId="UploadMenu"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
Title="My Upload Document"
Description="Upload a document from your computer to this library "
ImageUrl="/_layouts/images/UploadDoc.jpg">
<UrlAction Url=""/>
</CustomAction>
</Elements>
4.使用下面的bat脚本安装和激活Feature在Sharepoint中
@rem======================================================================
@rem
@rem setupfeature.bat
@rem
@rem======================================================================
@echo off
setlocal
pushd .
goto InstallFeature
@rem----------------------------------------------------------------------
@rem InstallFeature
@rem----------------------------------------------------------------------
:InstallFeature
set SPAdminTool=%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe
set TargetUrl=http://sharepoint-server:12345/sites/mysite001
set FeaturePath=MyUploadDocument\Feature.xml
echo InstallFeature %FeaturePath%
"%SPAdminTool%" -o installfeature -filename %FeaturePath%
echo Activating feature %FeaturePath%
"%SPAdminTool%" -o activatefeature -filename %FeaturePath% -url %TargetUrl%
echo iisreset
iisreset
5.以上就可以在你的Sharepoint站点的Shared Documents下添加这个自定义Feature了。