web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Custom Views on Specif...
Power Pages
Suggested Answer

Custom Views on Specific Folders

(1) ShareShare
ReportReport
Posted on by 2
I have different folders in a common /documents folder, and I was wondering if there's a way to create a view that only applies to a specific folder? If I press on the HR folder then a different view shows up than compared to IT. How should I go about doing that?
Categories:
I have the same question (0)
  • Suggested answer
    Jon Unzueta Profile Picture
    1,827 Super User 2025 Season 2 on at
     

    Yes, you can create folder-specific views in a SharePoint document library (like /documents/HR or /documents/IT) using metadata filtering or JSON view formatting. Here's how you can approach it:


    Option 1: Use Metadata Columns (Recommended)

    This is the most flexible and user-friendly method.

    Steps:

    1. Add a metadata column (e.g., "Department") to your document library.
    2. Tag each folder or file with the appropriate value (e.g., HR, IT).
    3. Create a custom view for each department:
      • Go to the document library.
      • Click "Create view".
      • Set a filter: Department is equal to HR.
      • Save the view as "HR View".
    4. Use Power Automate or a script to auto-tag files based on folder path (optional but helpful).

    Result:

    When users navigate to the HR folder, you can use Power Automate or custom scripting to redirect them to the "HR View".


    Option 2: JSON View Formatting (Advanced)

    You can use JSON to conditionally format views based on folder name.

    Example:

     

    {

      "schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",

      "hideColumnHeader": true,

      "rowFormatter": {

        "elmType": "div",

        "style": {

          "display": "=if([$FileDirRef] == '/sites/yoursite/Shared Documents/HR', 'block', 'none')"

        },

        "children": [

          {

            "elmType": "span",

            "txtContent": "[$FileLeafRef]"

          }

        ]

      }

    }

    This hides rows that don’t belong to the HR folder.


    Option 3: Power Pages or Power Apps Integration

    If you're building a custom UI (e.g., Power Pages), you can:

    • Use the folder path as a filter in your Dataverse or SharePoint connector.
    • Dynamically load different views based on the folder selected.

    🏷️ Tag me if you have any further questions or if the issue persists.

    ✅ Click "Accept as Solution" if my post helped resolve your issue—it helps others facing similar problems.

    ❤️ Give it a Like if you found the approach useful in any way.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard