Hey,
I have created a custom document library definition. It works fine.
Is it possible to deactivate the standard document library when I activate the feature with the custom document library definition?
Thanks for your help
Stefan
Technology Tips and News
Hey,
I have created a custom document library definition. It works fine.
Is it possible to deactivate the standard document library when I activate the feature with the custom document library definition?
Thanks for your help
Stefan
Hi,
According to your description, my understanding is that you want to deactivate the document library definition when activate the custom document library feature.
In the SPListTemplate class , there is no remove or delete method, so it could not be achieved in FeatureDeactivating event.
As a workaround, if you want to force user to use the custom document library template, you can hide the OOTB document library template in the add app layout page using Jquery. It is located at the path below:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\AddAnApp.aspx
You can add the Jquery code under the PlaceHolderMain tag to achieve it. The document library template is a first li element under ul element.
Here is a code snippet for your reference:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script> <script> $( document ).ready(function() { $( "#scrollDiv ul li" ).first().hide(); }); </script>
Here are some detailed code demo for your reference:
Thanks
Hi,
Standard document library definition is a part of site definition not a feature.
So the PowerShell command can't enable or disable the OOTB document library but it can disable the custom feature you developed.
Thanks
Best Regards
But when I run the PowerShell script the user cannot select the standard document definition when he like to create a document library.
Hats my goal, that the user has no chance to select the standard document library.
Regards
Stefan
Hi,
PowerShell command is not able to disable the document library definition, in this case, you can use Jquery to hide the document library template in the UI like the function above.
Thanks
Best Reagrds