Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Change The Project Owner Using REST API

I want to change the project owner of a project using REST API. I know there is a "/Owner" endpoint and I can get the owner without any problems with the following GET:

site/_api/ProjectServer/Projects('2cc734f2-cd16-4f09-8632-a2bc74a32577')/Owner

So how do I change the project owner using REST API?

like image 340
martin_jaehn Avatar asked Feb 01 '26 14:02

martin_jaehn


1 Answers

This is an old issue but I figured it might help someone since I recently struggeled with this too. I have only tested this on Project Online and not on-prem, probably works the same on Project Server 2016

  1. Start by checking out the project
  2. Send a PATCH request to:

    _api/ProjectServer/Projects('PROJECT ID')/Draft

    with the following headers:

    Accept: application/json; odata=verbose
    Content-Type: application/json; odata=verbose
    X-RequestDigest: The request digest
    If-Match: Either "*" or the etag value you get from checking out the project

    and the request body:

    { "__metadata": { "type": "PS.DraftProject" }, "OwnerId": "SharePoint User ID of the owner" }

    It's important that you send the "OwnerId" value as a string, not a number.

  3. Publish the project

like image 97
eXploit90 Avatar answered Feb 03 '26 11:02

eXploit90



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!