0

Having the SharePoint site where need to configure the access to the lists and libraries according the roles and permissions. How to define following hierarchy in SharePoint 2010 site. What groups I need to define ?

HR Department :
User1 -HR Manager
User2 -HR Assistant Manager
User3 -HR Team Lead
User4 -HR
User5 -HR
User6 -HR
User7 -HR 

Edited: Need to scenario like when logged in user sending mail to any other user then should get his manager information too, to keep him CC.

1 Answer 1

1
<script type="text/javascript" src="../../JSLibrary/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="../../JSLibrary/jquery.SPServices-0.4.8.min.js"></script>

<script type="text/javascript">

    $(document).ready(function () {

        var managerName;

        var userName = $().SPServices.SPGetCurrentUser();

        $().SPServices({

            operation: "GetUserProfileByName",

            async: false,

            AccountName: userName,

            completefunc: function (xData, Status) {

                managerName = $(xData.responseXML).text();

                var managerLength = managerName.length;

                var indexofManager = managerName.indexOf("Manager");

                managerName = managerName.substring(indexofManager + 13, managerLength);

                var indexOffalse = managerName.indexOf("false");

                managerName = managerName.substring(0, indexOffalse);

            }

        });

        var peoplepicker = $("tr:contains('Reporting Manager'):last").find("div[title='People Picker']");

        peoplepicker.html(managerName);

    });

Above code will help you to get manager.You can set it to any of the control & get it from there in Client side code. I had set it to SharePoint People Picket for an example here.

It is surely working in SharePoint Foundation 2010.

10
  • Ok, In this case If me as logged in user sending an email to say 'User5' then how to get its manager information like email id ?
    – Red Swan
    Commented Apr 11, 2016 at 10:52
  • It's completely a different scenario as you can get user's manager via c# code. Please raise proper question for this so i can provide sample source code to get logged in user's manager.
    – Hardik
    Commented Apr 11, 2016 at 10:57
  • Actually not expecting c# code here, but atleast should know how to define relationship like User4,USer5,User6,User7 has a User1 as manager. Then there should be a=some way to get managers list for user.
    – Red Swan
    Commented Apr 11, 2016 at 11:19
  • You can get list of manager by changing the last code as per your need.
    – Hardik
    Commented Apr 11, 2016 at 11:26
  • I am afraid this code won't run in SP 2010 foundation on .net 3.5 environment. Sorry didn't mentioned from my side.
    – Red Swan
    Commented Apr 11, 2016 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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