我正在尝试为SharePoint(Office 365)创建自定义列表操作,我需要获取当前列表视图。但是,如果我添加功能区操作,我有一些问题,以找到当前选定的列表视图。我的试验:
a)最好有一些带有当前视图ID的URL标记(如{View}),但看起来它不存在。
b)我有一个想法从源URL找到所选视图,但是如果我将Source = {Source}参数添加到自定义动作,我将Source解析为:Source = https://mysite.sharepoint.com/_layouts/15/commandui.ashx?ver=%2D1037522208&lcid=1033&qt=commandhandlers(而我期望像https://mysite.sharepoint.com/_layouts/15/start.aspx#/Lists/My%20List/AllItems.aspx?InitialTabId=Ribbon%2EList&VisibilityContext=WSSTabPersistence这样的东西)
C) .. ?
任何想法如何获得当前选择的列表视图?
看起来有一种方法可以为每个列表创建自定义操作。我的方法是删除注册类型和注册ID:
<CustomAction
Id="65695319-4784-478e-8dcd-4e541cb1d682.CustomAction"
Location="CommandUI.Ribbon"
Sequence="10001"
Title="Invoke custom action">
另一种方法是将内容的自定义操作注册到内容类型0x01:
<CustomAction
Id="65695319-4784-478e-8dcd-4e541cb1d682.CustomAction"
Location="CommandUI.Ribbon"
RegistrationType="ContentType"
RegistrationId="0x01"
Sequence="10001"
Title="Invoke custom action">
这样我就能得到预期的结果