sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Command Set Extension: Ability to set RegistrationType="ContentType" and RegistrationId="0x01"

Open AJIXuMuK opened this issue 9 years ago • 8 comments

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

  • [x] Question
  • [ ] Typo
  • [ ] Bug
  • [ ] Additional article idea

I'm trying to register Command Set Extension for all Content Types using Feature Framework. In classic SharePoint I was able to do that with RegistrationId="0x01" RegistrationType="ContentType", or even "RegistrationId="0x" RegistrationType="ContentType". But for Command Set such registration leads to error during App installation.

Is it a bug? Or by design? If by design - how do you propose to register the Command Set for all lists and libraries?

AJIXuMuK avatar Sep 20 '17 22:09 AJIXuMuK

The main use-case for this one is to be able to apply the Command Set extension to all types of content on the site. The other use case is to apply the Command Set to lists/libraries that have some specific Content type.

AJIXuMuK avatar Sep 26 '17 17:09 AJIXuMuK

I've ran into the same issue: All attempts to use RegistrationType="ContentType" fail. I've tried it along with RegistrationId values of "0x01" and "0x0100..." (my custom content types). The feature doesn't even show up. Simply changing elements.xml to RegistrationType="List" and RegistrationId="100" makes the solution work as expected with those settings.

paulewert avatar Oct 27 '17 20:10 paulewert

@AJIXuMuK Thanks for the feedback. We do not currently support ContentType, we support RegistrationType=List or RegistrationID=library template ID.

If you'd like to see this feature please create a request SharePoint UserVoice and based on community requests we will decide on features going forward.

dgaeta avatar Mar 19 '18 23:03 dgaeta

@dgaeta: That would be "RegistrationType='List'" and "RegistrationId='[library template id]'". Both settings are required; they work in tandem. Not "or".

Hopefully the documentation has been or will be updated soon to remove the RegistrationType of "ContentType", then. It really should be supported if the documentation says it is an option.

User Voice suggestion created: https://sharepoint.uservoice.com/forums/329220-sharepoint-dev-platform/suggestions/33706687-support-registrationtype-contenttype-in-command.

paulewert avatar Mar 21 '18 18:03 paulewert

bummer.. I am facing the same issue. How do i restrict the custom action to be available only on specific lists? Was some one able to figure out any workaround to it ?

dhavalshah01 avatar Apr 05 '18 19:04 dhavalshah01

@dhavalshah01 Well, I think the only way available is to check list title/url/id in the code of the customizer.

AJIXuMuK avatar Apr 05 '18 20:04 AJIXuMuK

@dhavalshah01: I did what @AJIXuMuK mentioned. Unfortunately, this means the Command Set Extension is running on more than just the list you want it to run on. You then hide the command (this.tryGetCommand('[mycommand]').visible = false) in the onListViewUpdated function when the list isn't the one you want (I did the discovery to check the list in the onInit function using properties in the this.context.pageContext.list object).

It would be good if SPFx would expand the registration types so we don't have to do this workaround. Don't forget to cast your votes in User Voice!

paulewert avatar Apr 10 '18 22:04 paulewert

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 29 '20 00:01 msft-github-bot