Displaying the Name of the Project Owner in Custom Client-Side Code RRS feed

  • Question

  • Hi!

    We are using AngularJS in conjuction with the Project Server JavaScript Object Model to display project information (like name of the project, name of the owner, etc.) on our custom page.

    Regarding a Project Server bug I already posted the code on my blog here.

    In the controller we have:

    var promise = OurCustomService.getProjInfo($scope);
    promise.then(function (pi) {
        var projName = pi.project.get_name();
        // for some users the get_owner() mehtod returns null
        var projManName = pi.project.get_owner().get_title();            
    }, function (errorMsg) {
        console.log("Error: " + errorMsg);
        }, function (errorMsg) {
            console.log("Error: " + errorMsg);

    In the costom service we access the data via:

    this.getProjInfo = function ($scope) {
       var deferred = $q.defer();
       var ctx = new SP.ClientContext.get_current();
       var projContext = PS.ProjectContext.get_current();
       var proj = projContext.get_projects().getById($scope.projectId);
       projContext.load(proj, "Name", "Owner.Title");
            function () {
                        project: proj
            function (sender, args) {
                deferred.reject('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
        return deferred.promise;

    The problem we are facing to, that although the users have permission to access general project properties, they typically cannot access the Owner property. As far as I see, the reason for that is that the Owner is an Enterprise Resource, and most of the users have no access to the Enterprise Resource object stored in the Owner property (due to the lack of the 'View Enterprise Resource Data' permission on the resource).

    We can't simply authorize all of the resource to allow all other resources, but the projects have typically owners whose position in the RBS is higher as the one of the project team members.

    When creating a new security category, we can select in the Resoures section the option '<label accesskey="?" for="idChkResourcesTeam">They are members of a Project Team on a project owned by the User', but there is no such option as '</label>They are members of the same Project Team as the User' or similar.

    Any idea how to create a workaround to the issue? One could read the name of the owner via the ProjectData REST service, but it would require extra permissions and would provide the user access to a lot of information they mustn't have access to.

    We could create a project event receiver (OnUpdating / OnUpdated) and store the name of the owner into a hidden SharePoint list item or into a web property. The users would have then read access to the value, but I hope there is a better / simpler solution available, either programmatically or via configuration.

    Thanks in advance!


    Friday, August 5, 2016 11:47 AM

All replies