SOLVED

Limit the display of a command set to a specific list instance

%3CLINGO-SUB%20id%3D%22lingo-sub-1312787%22%20slang%3D%22en-US%22%3ELimit%20the%20display%20of%20a%20command%20set%20to%20a%20specific%20list%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1312787%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EAccording%20to%20this%20Microsoft%20article%26nbsp%3B%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fextensions%2Fget-started%2Fbuilding-simple-cmdset-with-dialog-api%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fextensions%2Fget-started%2Fbuilding-simple-cmdset-with-dialog-api%26nbsp%3B%3C%2FA%3E%26nbsp%3Bon%20how%20to%20create%20command%20set%20extension%2C%20one%20can%20publish%20a%20command%20to%20one%20or%20more%20generic%20type%20of%20lists%20%2F%20document%20libraries%20by%20setting%20them%20in%20the%20file%20elements%2Cxml.%3C%2FP%3E%3CP%3EFor%20instance%2C%20making%20all%20custom%20lists%20display%20the%20command%20set%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3ERegistrationId%3D%22100%22%0ARegistrationType%3D%22List%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20I%20want%20a%20command%20set%20to%20appear%20in%20%3CU%3Eonly%20one%20specific%20list%20instance%20r%3C%2FU%3Eather%20than%20in%20all%20custom%20lists%20%2F%20document%20libraries.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDo%20you%20know%2C%20how%20this%20be%20done%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3CP%3EFilipe%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1312951%22%20slang%3D%22en-US%22%3ERe%3A%20Limit%20the%20display%20of%20a%20command%20set%20to%20a%20specific%20list%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1312951%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EYes%2C%20you%20can%20apply%20list%20view%20command%20set%20to%20a%20specific%20list%2Flibrary.%3CBR%20%2F%3EPlease%20refer%20this%20link%20which%20will%20be%20helpful%20-%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F52807.spfx-extension-apply-list-view-command-set-to-specific-list-or-library.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsocial.technet.microsoft.com%2Fwiki%2Fcontents%2Farticles%2F52807.spfx-extension-apply-list-view-command-set-to-specific-list-or-library.aspx%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20hope%20this%20helps.%3CBR%20%2F%3EThanks.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1332556%22%20slang%3D%22en-US%22%3ERe%3A%20Limit%20the%20display%20of%20a%20command%20set%20to%20a%20specific%20list%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1332556%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F114813%22%20target%3D%22_blank%22%3E%40Swaminathan%20Sriram%3C%2FA%3E%2C%3C%2FP%3E%3CP%3ESorry%20for%20the%20late%20feedback.%20Your%20answer%20did%20help.%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3CP%3EFilipe%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1496294%22%20slang%3D%22en-US%22%3ERe%3A%20Limit%20the%20display%20of%20a%20command%20set%20to%20a%20specific%20list%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1496294%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F223877%22%20target%3D%22_blank%22%3E%40Filipe%20Matos%3C%2FA%3E%26nbsp%3B-%3CFONT%20size%3D%222%22%3E%20I%20think%20hardcoding%20the%20listname%20is%20not%20a%20great%20solution.%20Have%20a%20look%20here%20%3A-%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3E%3CA%20href%3D%22https%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fenabling-an-spfx-listview-command-set-on-a-specific-sharepoint-list%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.c-sharpcorner.com%2Farticle%2Fenabling-an-spfx-listview-command-set-on-a-specific-sharepoint-list%2F%3C%2FA%3E%26nbsp%3Bwhere%20the%20dev%20uses%20the%20site%20property%20bag%20to%20enumerate%20the%20lists%20guids%20which%20will%20have%20the%20functionality.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20size%3D%223%22%3EWould%20be%20good%20if%20SpFx%20natively%20had%20more%20scoping%20options.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1497678%22%20slang%3D%22en-US%22%3ERe%3A%20Limit%20the%20display%20of%20a%20command%20set%20to%20a%20specific%20list%20instance%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1497678%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F713407%22%20target%3D%22_blank%22%3E%40SeanyC67%3C%2FA%3E%3C%2FP%3E%3CP%3EThank%20you%20for%20pointing%20this%20out%2C%20I%20will%20have%20a%20look%20at%20it.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi,

According to this Microsoft article  https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-w... on how to create command set extension, one can publish a command to one or more generic type of lists / document libraries by setting them in the file elements,xml.

For instance, making all custom lists display the command set:

 

RegistrationId="100"
RegistrationType="List"

 

 

However, I want a command set to appear in only one specific list instance rather than in all custom lists / document libraries.

 

Do you know, how can this be done?

 

Thank you

Filipe

 

 

4 Replies
Highlighted
Best Response confirmed by Filipe Matos (Occasional Contributor)
Solution
Hi,
Yes, you can apply list view command set to a specific list/library.
Please refer this link which will be helpful -
https://social.technet.microsoft.com/wiki/contents/articles/52807.spfx-extension-apply-list-view-com...

I hope this helps.
Thanks.
Highlighted

Hi @Swaminathan Sriram,

Sorry for the late feedback. Your answer did help.

Thank you

Filipe

Highlighted

Hi @Filipe Matos - I think hardcoding the listname is not a great solution. Have a look here :-

https://www.c-sharpcorner.com/article/enabling-an-spfx-listview-command-set-on-a-specific-sharepoint... where the dev uses the site property bag to enumerate the lists guids which will have the functionality.

Would be good if SpFx natively had more scoping options.

Highlighted

Hi @SeanyC67

Thank you for pointing this out, I will have a look at it.