2

I am building a list, where I want to protect certain columns from editing by the users. I understood that Sharepoint does not have column protection functionality. One of the workarounds is to have the columns that I want to protect in another list. 

So, I built 2 lists: - List A (actually a document library): editable by users - List B: not editable by others

In List B, one of the column is the ID in List A.

How do I add List B's columns into List A? I tried creating a lookup column in List A. But, I have to manually select the ID. There is a chance that the users may select the wrong ID. Is there any way I can lookup to the columns in List B using the ID of List A's items?

Another question, if in List B, I have multiple entries for 1 item in List A, how do I retrieve the value of the last entry that matches?

Thanks. 

0

You are correct - there is no out of the box feature using which we can restrict the column level access. In fact, there was a question raised in the Microsoft community - the answer was below:

There is no out-of-the-box feature to set permission restriction on editing column in SharePoint Online.

However, some third-party tools or java scripts may achieve this feature. Here are some threads for your reference:

Column level permissions

SharePoint Online / Office 365 - Column Level Security - Issues And Possible Options

Coming to your question - instead of going with lookup column approach, you can try with the below javascript code which will hide certain column based on the user or condition on the new and edit form.

<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();       
}
     }
  });
});

References:

Restrict edit access to certain columns in a SharePoint List

Hide a SharePoint list field based on user group using JQuery Webservice in 2010

Having said these - you want to continue with the lookup column approach, you need to develop a workflow in the list B which will set the correct value in the List A.

0

If you want to look up columns in List B using the ID of List A's items, consider using SharePoint Designer Workflow to do the trick.

For example, whenever you create a new item (document) in List A, automatically create a new record in List B and update the column properties based on the properties of the item in List A.

Set the workflow to run on item creation so that the item properties in List B do not change after creation.

PS. Microsoft Flow would be a better solution except that it cannot update lookup columns using Lookup control. If you do not need the lookup columns, use Flow instead.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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