カスタム アクションの定義
カスタム アクション ファイルは、フィーチャーの一部に含まれ、XML 要素の記述として展開されます。カスタム アクション ファイルは、1 つの CustomAction 要素を使用して構造化されます。この要素が、リスト アイテムまたはツール バー アイテムの単一カスタム アクションのコア定義となります。
例
次の例は、ソリューションの .wsp ファイルにパッケージ化できるカスタム アクション ファイルを定義します。
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<CustomActionGroup
Id="VirtualServerConfiguration"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Title="Virtual Server Configuration"
Sequence="10"
ImageUrl ="/images/listset.gif"
Description="Use these links to install Windows SharePoint Services on a new virtual server, configure settings across all sites on a virtual server, or create a new top-level Web site. "/>
<CustomAction
Id="Extend"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="10"
Title="Extend or upgrade virtual server"
Description="">
<UrlAction Url="vslist.aspx?NextPage=extendvsoption.aspx&Show=NeedExtend&Show=NeedUpgrade"/>
</CustomAction>
<CustomAction
Id="CreateSite"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="20"
Title="Create a top-level Web site"
Description="">
<UrlAction Url="vslist.aspx?NextPage=createsite.aspx&Show=Ready"/>
</CustomAction>
<CustomAction
Id="DeleteSite"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="30"
Title="Delete site collection"
Description="">
<UrlAction Url="delsite.aspx"/>
</CustomAction>
<CustomAction
Id="ConfigureVirtualServer"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="40"
Title="Configure virtual server settings"
Description="">
<UrlAction Url="vslist.aspx?NextPage=vssettings.aspx"/>
</CustomAction>
</Elements>
CustomActionGroup 要素には、カスタム アクションのグループのコア定義が含まれます。
UrlAction 要素を使用して、カスタム アクションの URL を指定する必要があります。アクションが指定されていない場合 (エラー状態)、リンクは表示されるだけで、どこにもリンクされません。
HideCustomAction 要素を使用して、Windows SharePoint Services フィーチャーのインフラストラクチャ内、または別のカスタム アクション内に既定で実装される既存のアクションを非表示にします。既定のカスタム アクション ID の一覧については、「カスタム アクションの既定の場所および ID」を参照してください。
次の例は、Windows SharePoint Services ページの既定のアクションを、新しいアクションに置き換える XML ファイルの内容を示しています。カスタム アクションの定義と登録の手順を紹介したプログラミング作業については、「[方法] ユーザー インターフェイスに操作を追加する」を参照してください。
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<CustomActionGroup
Id="PortalAnalytics"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Title="Usage Reporting"
Sequence="50" />
<CustomAction
Id="ManageAnalytics"
GroupId="PortalAnalytics"
Location="Microsoft.SharePoint.Administration.ApplicationManagement"
Sequence="10"
Title="Configure usage reporting" >
<UrlAction
Url="_layouts/SpUsageConfig.aspx"/>
</CustomAction>
<HideCustomAction
Id="HideWssSiteCollectionUsage"
HideActionId="SiteCollectionUsage"
GroupId="SiteCollectionAdmin"
Location="Microsoft.SharePoint.SiteSettings" />
<HideCustomAction
Id="HideWssWebUsage"
HideActionId="WebUsage"
GroupId="SiteAdministration"
Location="Microsoft.SharePoint.SiteSettings" />
<CustomAction
Id="PortalSiteUsage"
GroupId="SiteCollectionAdmin"
Location="Microsoft.SharePoint.SiteSettings"
Rights="ViewUsageData"
Sequence="30"
Title="Site usage data">
<UrlAction
Url="_layouts/SpUsageSite.aspx" />
</CustomAction>
<CustomAction
Id="PortalWebUsage"
GroupId="SiteAdministration"
Location="Microsoft.SharePoint.SiteSettings"
Rights="ViewUsageData"
Sequence="30"
Title="Web usage data">
<UrlAction
Url="_layouts/SpUsageWeb.aspx" />
</CustomAction>
</Elements>