none
Getting project in delegation mode using JS RRS feed

  • Question

  • I need to check in project on Project Schedule page using JS. 

    I can do it. However when a current user uses delegation mode I receive the error 'CSOMDelegationNotSupported' on executing function 'executeQueryAsync'.

    I use MS Project Server 2016 On Promise.

    Could you help me work out how to work with delegation mode using JS and how to get project details and project draft object?

    My code that works for a normal mode and doesn't work in delegation mode

    var globalProjUid = 'b022efa8-2a67-e911-80c6-005056ab5675';
    SP.SOD.executeOrDelayUntilScriptLoaded(runCheckIn, "PS.js"); //Load PS.js
    
    
    function runCheckIn()
    {
    	projectContext = PS.ProjectContext.get_current();//;('http://mycompany.com/sites/PWA/')
    	projects = projectContext.get_projects();
    	projectContext.load(projects);
    
    	//Send the request to the server
    	console.info('Run check in. Load projects');
    	projectContext.executeQueryAsync(LoadProject, errorHandler);
    }
    
    
    function LoadProject()
    {
    	//Create variable that will hold specific project information
    	project = projects.getById(globalProjUid); 
    	var res = projectContext.load(project);
    	console.info('Project load finished');
    	var res2 = projectContext.executeQueryAsync(ProjectLoadFinished, errorHandler);
    }
    
    
    function ProjectLoadFinished() {
    //The project Variable contains published information
    //console.info('Load project', project.get_checkedOutDate());
    
    //In order to change the project you need to Checkout the Project
    draft_project = project.get_draft();
    
    //console.info('Draft project info', draft_project.get_owner());
    var job = draft_project.checkIn(true);
    projectContext.waitForQueueAsync(job, 100, function(response){console.info(response)});
    }


    • Edited by Shamak Slava Sunday, June 2, 2019 2:34 PM Version MS Project was added
    Sunday, June 2, 2019 12:01 PM

Answers