Publishing All Projects using Script


Sometimes we need to publish all projects from our customers.

We have some options to do that, one of them is using script

In my case, I’ve published using the Project Names, but you can do using other fields, just adjust the script.

Remember, when you run this script, all items will go to the Project Online queue.

Var names = ['project name 1',  //ALWAYS LOWER CASE
             'project name 2',
             'project name 3']

var pp;
var context = PS.ProjectContext.get_current();
var pjs = context.get_projects();
context.load(pjs, 'Include(Id,Name)');
var it = pjs.getEnumerator()
  var p = it.current;
 if(names.indexOf(p.get_name().toLocaleLowerCase()) >= 0)
      var draft = p.checkOut();

Now, connect to your Project Online, open the project center, press “F12” to open the developer tools page and run the script.

I hope it helps you!!!

The script is provided “As is” with no warranties etc. – this is just a free solution starter so is use at your own risk.

#ProActive  #JoinUs

Diego Pereira

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog do Douglas Romão

MVP Office Apps and Services | Modern Workplace and Business Applications Expert

Blog do Project

Tudo que você queria saber sobre Microsoft Project


by Allan Rocha

Modern Work Management - Project and the Power Platform blog

Microsoft Project, Project Online, Project for the Web and the Power Platform

%d bloggers like this: