deactivate the standard document library feature

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 

March 22nd, 2015 12:10pm

Do you mean the standard document library is "Shared Documents"? then these documents are part of site definition and comes along with the site template you use to create sharepoint site. If you want to have these library excluded from the site, you may need to create a custom site template or a programmatical approach to remove the existing document library on feature activation.
Free Windows Admin Tool Kit Click here and download it now
March 22nd, 2015 5:07pm

I meand the document library definition feature.
March 22nd, 2015 6:23pm

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:

Jquery find the first li

Jquery hide funtion

Thanks

Best Regards

Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2015 7:55am

Thanks for your help.
In PowerShell can I disable this feature with
Disable-SPFeature -identity "MyCustom" -URL http://somesite

The PowerShell command I want to bring in the complete solution (wen activate the feature then disable the feature (standard document library definition) and by deactivate the feature then enable the feature (standard document library definition)).

Regards
Stefan


March 23rd, 2015 9:05am

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

Free Windows Admin Tool Kit Click here and download it now
March 23rd, 2015 9:16am

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 

March 23rd, 2015 9:28pm

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

Free Windows Admin Tool Kit Click here and download it now
March 24th, 2015 10:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics