Share via

createTaskAsync in Office JS Project Add-in — No way to insert task at specific position or under a parent task?

Abdelrahman Alnashar 0 Reputation points
2026-05-11T12:45:13.7966667+00:00

I am building a Microsoft Project add-in using Office JS (task pane). My use case is syncing tasks from an external web app into an existing MSP file that already has a structured hierarchy of parent tasks (todos) and child tasks beneath them.

The Problem: When a new child task is added in the external app under an existing parent task, I need to sync it into MSP and place it under the correct parent task — not at the bottom of the entire project.

What I have tried:

  • createTaskAsync — always appends to the end of the project with no position parameter
  • Setting OutlineLevel via setTaskFieldAsync after creation — changes indent visually but MSP determines parent-child by row position, not outline level alone, so it ends up as a child of the wrong parent
  • Iterating tasks via getTaskByIndexAsync to find the parent — I can find the parent GUID and index, but there is no API to insert after a specific index

What I confirmed is missing from the API: Looking at the complete Office.Document method list on Microsoft Learn, there is no:

  • insertTaskAsync
  • moveTaskAsync
  • setTaskParentAsync

Microsoft's own documentation confirms: "There's currently no application-specific JavaScript API for Project; you'll use Common APIs to create Project add-ins."

My Question: Is there any pure Office JS approach to insert a task at a specific position or under a specific parent task in an already-structured MSP file? Or is the only solution a VSTO/VBA hybrid?

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments

1 answer

Sort by: Most helpful
  1. Gabriel-N 17,785 Reputation points Microsoft External Staff Moderator
    2026-05-11T14:37:31.2233333+00:00

    Hello Abdelrahman Alnashar

    After reviewing the API surface and the available documentation, I believe you have already reached the correct conclusion on this matter.

    At the moment, there is no pure Office JavaScript solution that allows inserting a task at a specific position or directly under a given parent task in Microsoft Project Desktop.

    Microsoft’s own documentation explicitly acknowledges this limitation. In Task pane add-ins for Project it states:

    User's image

    This is reinforced in the GitHub thread you referenced: office-js issue #4614, where a Microsoft contributor also said that: "Project can use the Common APIs, but does not have application-specific APIs in Office.js"

    Even setTaskFieldAsync on OutlineLevel/OutlineNumber only changes the visual indent—it does not establish true parent-child relationships, because Project determines hierarchy primarily by the physical row order in the task list.

    Taken together, this confirms that the lack of APIs such as task insertion at a specific index, task movement, or explicit parent–child assignment is a platform limitation, not a misuse of Office JS.

    Given this, the most viable alternatives are:

    • Using COM/VBA or VSTO for Project Desktop, which gives you full control over task insertion, hierarchy, and ordering.
    • Considering Project for the Web / Microsoft Graph / Dataverse APIs (Project Online is retiring in September 2026), which offer more flexible task management—if your product architecture allows migration.

    Unfortunately, within the constraints of pure Office JS for Project Desktop .mpp files, this scenario is not currently achievable.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.