locked
How to filter default document libraries from custom created? RRS feed

  • Question

  • Hello all,

    I hope someone here can help me.

    I'm looking to filter default document libraries (e.g. Documents,Form Templates, Images, Site Collection Documents, Site Collection Images, Style Library) from the ones created by me (e.g. "DocLibAleks") using PowerShell.

    I was trying to use properties of SPWeb Lists but without any success.

    Any other ideas?

    Regards

    Aleks


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.

    Friday, June 14, 2019 12:11 PM

Answers

  • Hi Aleks,

    We can achieve your requirement by PowerShell script.

    There is a demo for your reference.

    $web=Get-SPWeb yoursiteURL
    
     foreach($list in $web.Lists)
    
       {
    
       if($list.Title -eq "Documents"  -or $list.Title -eq "Form Templates" -or $list.Title -eq "Images" ) #you could add the default document library in the condition.
    
           {
    
                      
    
     
    
                       if($list.Author.Name -contains "yourname")
    
                       {
    
                          
    
                       $list|Format-List -Property Title, Author
    
                       }
    
                      
    
                       }
    
       }
    
      


    Best regards,

    Sara Fan


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Monday, June 17, 2019 7:22 AM
  • Hello all,

    Thank you everyone for your replies.

    Definitely if I'm the author the proposed solution will work, but this is not always the case.

    I found another way to filter most of the "system" document libraries:

    • Description of them always contains "*system*".

    Only in case, if someone put "system" in the document library description this approach won't work correctly.

    Regards

    Aleks


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.


    Wednesday, June 19, 2019 6:56 AM

All replies

  • Hi Alek,

    I don't think is there way to filter default document libraries from SharePoint UI prospective, you might have write some custom code i guess i don't think that is possible either.

    Below article will get you default lists & libraries:

    http://wiki.plexhosted.com/kb/Microsoft_SharePoint_2013:Default_Lists_and_Libraries

    Thanks & Regards,


    sharath aluri

    • Proposed as answer by Sara Fan Monday, June 17, 2019 1:53 AM
    • Unproposed as answer by Sara Fan Monday, June 17, 2019 1:54 AM
    Friday, June 14, 2019 1:50 PM
  • Hi Aleks,

    We can achieve your requirement by PowerShell script.

    There is a demo for your reference.

    $web=Get-SPWeb yoursiteURL
    
     foreach($list in $web.Lists)
    
       {
    
       if($list.Title -eq "Documents"  -or $list.Title -eq "Form Templates" -or $list.Title -eq "Images" ) #you could add the default document library in the condition.
    
           {
    
                      
    
     
    
                       if($list.Author.Name -contains "yourname")
    
                       {
    
                          
    
                       $list|Format-List -Property Title, Author
    
                       }
    
                      
    
                       }
    
       }
    
      


    Best regards,

    Sara Fan


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.


    Monday, June 17, 2019 7:22 AM
  • Hi Aleks.

    Both the SPDocumentLibrary class and the SPList class expose a property named "Author" which returns a SPUser object that represents information about the user who created the list: you can use the below PowerShell snippet to query that property

    $web = Get-SPWeb http://siteweburl
    $list = $web.Lists["MyList"]
    $list.Author

    Bye.


    Luigi Bruno
    MCP, MOS, MTA, MCTS, MCSA, MCSE

    Monday, June 17, 2019 7:52 AM
  • Hi Aleks,

    If the reply is helpful to you, you could mark the reply as answer. Thanks for your understanding.

    Best regards,

    Sara Fan

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, June 19, 2019 6:42 AM
  • Hello all,

    Thank you everyone for your replies.

    Definitely if I'm the author the proposed solution will work, but this is not always the case.

    I found another way to filter most of the "system" document libraries:

    • Description of them always contains "*system*".

    Only in case, if someone put "system" in the document library description this approach won't work correctly.

    Regards

    Aleks


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.


    Wednesday, June 19, 2019 6:56 AM
  • Hi Aleks,

    It is very happy that you have resolved your problem.

    Thank you for your sharing and it will help others have the same issue.

    Best regards,

    Sara Fan

    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, June 19, 2019 7:11 AM