Forum Discussion

Bhavpreet Bains's avatar
Bhavpreet Bains
Iron Contributor
Feb 27, 2019

Getting to know which sharepoint group user is a member of json

Hello,

 

I am trying to find a way with which some columns of a SharePoint list can be hidden from users that belong to a SharePoint group. The only way I can think of is by column/view formatting. If the user (@me) belong to this group, hide the column value or header. However, I am not sure if it is possible to know which SharePoint group user (@me) belong to.

 

Does anyone know how to fetch the user SharePoint group name in JSON?

 

I am open to any other ideas with which hiding columns can be accomplished. 

 

Thank you.

BB

  • Dean_Gross's avatar
    Dean_Gross
    Silver Contributor
    you can do this by using PowerApps to customize the list form
    • Bhavpreet Bains's avatar
      Bhavpreet Bains
      Iron Contributor
      Hello Dean,
      Yes, with PowerApps the form to enter the data can be customized but I am good with the data being entered. I would like to get the view to show certain columns only or the unauthorized users not be able to access full content.
      Thank you.
      • Beau Cameron's avatar
        Beau Cameron
        MVP

        There is no guaranteed way to prevent a user from seeing the data in the item. If a user has access to an Item, they have access to fields on that item.

        With that being said, you could provide only a set of views the users can see with columns hidden.... 

        Otherwise, you'll have to build a SPFx Field Customizer to inject JavaScript to show/hide the value in those fields. Ultimately, I'm not sure it's worth the effort especially given the user can just click the details of the item, and view all of the fields.

Resources