Question

I am trying to create a custom list action for SharePoint (Office 365) and I need to get current list view. However if I add ribbon action I have some problems to find currently selected list view. My trials:

a) It would be the best to have some url tokent (like {View}) with current view ID, however it looks like such does not exist.

b) I had an idea to find selected view from the source url, however if I add Source={Source} parameter to the custom action, I get Source resolved to : Source=https://mysite.sharepoint.com/_layouts/15/commandui.ashx?ver=%2D1037522208&lcid=1033&qt=commandhandlers (while I'd expect something like https://mysite.sharepoint.com/_layouts/15/start.aspx#/Lists/My%20List/AllItems.aspx?InitialTabId=Ribbon%2EList&VisibilityContext=WSSTabPersistence )

c) .. ?

Any ideas how to get currently selected list view?

Was it helpful?

Solution

it looks like there are more then one way to create custom action for every list. My way was just remove RegistrationType and RegistrationId:

<CustomAction 
      Id="65695319-4784-478e-8dcd-4e541cb1d682.CustomAction"
      Location="CommandUI.Ribbon"
      Sequence="10001"
      Title="Invoke custom action">

Another way is to register custom action to content to content type 0x01:

<CustomAction 
       Id="65695319-4784-478e-8dcd-4e541cb1d682.CustomAction" 
       Location="CommandUI.Ribbon"    
       RegistrationType="ContentType"
       RegistrationId="0x01"
       Sequence="10001" 
       Title="Invoke custom action">

This way I get results as expected

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top