1

In a document library, I create folders, sub-folders, and upload documents into the sub-folders. This is done programmatically.

For all of these objects, I'm adding a field "Level" that will determine whether the object is a folder, or document.

Based on the value of this column, I would like to control what columns are shown in the view.

Is this possible?

0

2 Answers 2

1

If you only want to display the values for the documents, but are okay with the column headers appearing, but no values residing in those column headers for folders in the view:

In a classic site, this is pretty straightforward.

From a very high level, this can be achieved using:

  • A navigational link targeting the URL of an OOB web part page,
  • On that page, displaying an ‘app part’ web part with a top level view displaying the top level folders,
  • customize the content type for the documents so that only the documents, not the folders have the columns you desire - OOB, the Folder content type has only a ‘name’ and ‘title’ column available,
  • add the columns you want displayed for documents in the library to the document content type, and
  • Setting the default view for a library to a different view with the columns you want displayed

How to:

  1. Create a new ‘Standard’ view for your library for the top-level view. Let’s call it ‘folder view’.
  2. Select the columns you want to display when folders are viewed from the top level of the library. If none, be sure to include these two fields ‘ Type (icon linked to document)‘ and Name (linked to document)’ column or neither the name of the folder nor the icon will appear,

    • Select the other options you want for the view,
    • at the bottom of the view configuration page, under the ‘Folders’ section, ensure that you select the ‘show items in folder’. (See image below)sharepoint in-line classic library foldering
  3. Create a new web part page on your site. Add a App Part web part for the library. Configure the web part to only display the ‘folder view’ that was just created.

    • Add this web part page’s URL to the sites navigation so that there is no other entry point clickable by a user.
  4. Enable content type customization in the library settings. Then click the document content type and add the columns you want to display.
  5. Create a new view for the document library, select your document content type columns that you want to display as you desire, but set it as the default view for the library. (When users click on the top level folder on the page you created in step 3, they will land on the default view you just created in this step.

Caveats:

  • Perform these steps in the order outlined above

  • You May see column headers for the document content type when viewing second-level folders or deeper, but they will be empty.

  • If your requirement is to display None of the column headers for the document content type at any time, you need to add a mix of JS and CSS to your default view page and key off your custom ‘level’ column.
1
  • If I understand your question correctly, you can achieve that using the method above. You can select whatever columns you want to display for both the top level folder view in (step 3) and the view that displays the contents of the folders (step 5) Apr 12, 2019 at 13:20
1

You can do that by customizing form using PowerApps (modern) or Infopath\SP Designer (in classic experience)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.