I have a list with a column SSN. I don't want to show this list column for all users in the site. I want to show this list column for only users who are in certain SharePoint groups how to do it?
-
Which version of SharePoint is it? Are you talking about list forms or views?user19105– user191052015-04-09 05:02:01 +00:00Commented Apr 9, 2015 at 5:02
-
where do you want to hide the column SSN. List Views / Forms?Shantha Kumar Thambidurai– Shantha Kumar Thambidurai2015-04-09 05:27:55 +00:00Commented Apr 9, 2015 at 5:27
-
I would use Target AudienceYogaPanda– YogaPanda2017-04-28 16:19:42 +00:00Commented Apr 28, 2017 at 16:19
3 Answers
There is no OOB way of limiting the access to a list column. The column can be hidden from the form using JavaScript but users can still see the page source and grab the information from there. Following example shows how to do it using JavaScript:
<script type="text/javascript" src="/Shared%20Documents/JS/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="/Shared%20Documents/JS/jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
var xml = xData.responseXML.xml;
if (xml.search('Test Group') != -1)
{
var feedbackField = $("input[title=Feedback]");
feedbackField.parent().parent().parent().hide();
}
}
});
});
</script>
Source: http://www.sharepointnadeem.com/2011/09/hide-sharepoint-list-field-based-on.html
If hiding the column is sufficiënt you can use Nadeems' answer. You can also hide the information securely using out of the box techniques explained below.
The steps
- create a seperate (custom) list only for SSN's
- give this list the read permissions as you would like your SSN column to have
- add a sample SSN (use the title field)
- In your main list (not the new SSN list) add a column of type "lookup" and select the SSN list. Leave all other settings default
- now when adding a new item to your main list, you can select the sample SSN from a dropdown box
To what effect
Even though the lookup column will not disappear, the value will be hidden to users not authorized to the SSN list.
Note
If you don't want to go to the SSN list every time you add an item then you could create a SharePoint workflow to automate this process with a SSN column in the main list whos value is moved to the SSN list after adding.
-
Unfortunately SharePoint has not column permissions, but your solution is the strongest.Nico– Nico2017-04-28 16:23:23 +00:00Commented Apr 28, 2017 at 16:23
I guess you can use info path if you open and customize through info path filler. And hide the field if login is not equal to login id.