0

I'm pretty new to Sharepoint and what I would like to do is create a huge master list of all our employees and then make different "views" on that person depending on the persons group

For example:

A new employee might have

  • Salary info
  • Security info
  • Personnel info
  • Contract info

I would like to have all that in one row (per employee) but then when someone from the hr group logs in they can only see Personnel and Salary or something like that.

If that is not an option is there a way to link tables across different lists?

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Crash893
  • 737
  • 2
  • 15
  • 30

3 Answers3

3

Solution with no asp code:

You will need two javascript libraries:
- Jquery
- SPServices - http://spservices.codeplex.com/

In sharepoint, create a non-public library called "Jquery libraries" and upload your jquery and SPServices to it.

In sharepoint designer, create a copy of AllItems.aspx.

In sharepoint designer, edit the file AllItems.aspx. Clear all the code and insert this javascript code.

        <script language="javascript" type="text/javascript" src="PATH-TO-YOUR-JQUERY-FILE"></script>
<script language="javascript" type="text/javascript" src="PATH-TO-YOUR-SPSERVICES-FILE"></script>

<script type="text/javascript">
$(document).ready(function() {
    //Get current username
    userName = $().SPServices.SPGetCurrentUser({
        fieldName: "Name",
        debug: false
    });

    //get user's group
    $().SPServices({
        operation: "GetGroupCollectionFromUser",
        userLoginName: userName,
        async: false,
        completefunc: function(xData, status){

            $(xData.responseXML).find("Group").each(function(){
                if(status == "success"){
                    var nomeGrupo = $(this).attr('Name');
                    //if user is in group 1 redirect to page 1. If user is in group 2 redirect to page 2 etc...
                    if(nomeGrupo=="Grupo sergio"){
                             window.location.replace("PATH-TO-PAGE-1/SomeItems.aspx");
                    }else{
                        window.location.replace("/PATH-TO-PAGE-2/ViewAll.aspx");
                    }

                }else{
                    alert("Falha na comunicação com o Sharepoint");
                }
            });
        }
    });
});
</script>

This code will redirect the user to other pages that will contain customised web-parts-view.

In sharepoint design, rename the AllItems.aspx to SomeItems.aspx (for example).

You can create multiples copys of this file and follow the next step to customise it.

Edit this file and delete the main webpart located at PlaceHolderMain.(Tip: u can click and delete if u are in split view(code an design) in sharepoint designer).

Then, you can insert a custom web part view for your list. In this custom view, you can filter data or not display some colums.

2

Easy. 1 list. Several different views for that list, based on metadata - department, building, whatever. You can show different cols in each view. For instance...for HR, you'd show the salary col as well as the name col. For regular people, another view that does NOT show the salary.

Now we make a few web part pages. On each web part page, put a web part that shows our list. But it only shows one view of that list, with no real way to get to any others.

Now we restrict permissions for each of those web part pages to only the group(s) that you want to see it.

So - web part pages that show different views of the same list, and permission restrictions on those web part pages.

  • I am totally agree with SharePointAdminGuy. However, as a developer of [SharePoint Column permission](http://www.sharepointboost.com/columnpermission.html), I do not believe you can hide specific column from individuals. – user63078 Jan 12 '11 at 07:33
1

Hi I managed to hide a field programmatically see below. The Approve field is now hidden in the edit screen of the list

SPField Appprove = bdcList.Fields.GetField("Approved");
                        Appprove.ShowInEditForm = false;
                        Appprove.ShowInDisplayForm = true;
                        Appprove.ShowInNewForm = false;
                        Appprove.Update();
user9517
  • 114,104
  • 20
  • 206
  • 289
Grahame
  • 11
  • 1