SharePoint Online - How to display folders/ files in a document library based on user login ID/ Email

Ching Song Lim 41 Reputation points
2023-07-03T07:35:11.3333333+00:00

Environment :

SharePoint Online

Background :

I have a SharePoint Online site and there will be a common document library for different department user to upload document.

Objective :

Users should be able to view folders/ files that belong to their own department.

Question :

How to achieve above objective based on user login ID or email address?

For example :

User Department ID Email
UserA Human Resource DomainABC/HR_UserA userA@hr_abc.com
UserB Finance DomainABC/FIN_UserB userB@fin_abc.com
Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
{count} votes

2 answers

Sort by: Most helpful
  1. Ling Zhou_MSFT 23,620 Reputation points Microsoft External Staff
    2023-07-03T09:37:01.1833333+00:00

    Hi @Ching Song Lim,

    Thank you for posting in this community.

    I regret to inform you that SharePoint Online does not have an out-of-the-box method to display different files in the file library according to the login account.

    I have an alternative way to allow people in different departments to view files or folders in their own department. You can see if you can use it as an alternative.

    1. Create two folders in the file library to hold files or folders for each of the two departments.

    User's image

    1. Create a group for people in the same department.
    • Please go to Site Content->Site Settings->Users and Permissions ->people and groups.

    User's image

    • Groups->more->New Group.

    User's image

    User's image

    User's image

    1. Add permissions to folders so that only people in the corresponding department can access or edit the contents of the folder.
    • Select Folder->Manage access->Advanced Settings. User's image

    User's image

    • Click Stop Inheriting Permissions User's image
    • Grant Permissions. Select the group which you created for Finance department and give a permission level for this group. That is what permissions this group has on Finance folder. User's image
    • Do the same for another department.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Ling Zhou_MSFT 23,620 Reputation points Microsoft External Staff
    2023-07-07T08:05:10.3066667+00:00

    Hi @Ching Song Lim,

    Thank you for your reply.

    Perhaps you could consider using the SharePoint Framework as a custom solution.

    Here is the link about SharePoint Framework: Overview of the SharePoint Framework.

    Since I have limited resources for the SharePoint Framework. If you have questions about using the SharePoint Framework, please add the "SharePoint Development" tag to your question. We will have people on our team who are well-versed in the SharePoint Framework to work with you to solve problems.

    Thank you for your kind understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.