1

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?

martin_jaehn
  • 180
  • 2
  • 11

2 Answers2

2

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

eXploit90
  • 36
  • 3
-1

The general way to change site owners using REST API according to MSDN is:

POST http://<sitecollection>/<site>/_api/site/owner

So in your case you should just have to change from a GET command to POST

Dan
  • 425
  • 2
  • 13
  • But what do I have to send in the body of the REST API call? – martin_jaehn May 01 '17 at 11:53
  • @Dan: Sorry for the downvote, but the question is related to the project owner. Your answer is related to the SharePoint site owner. That has with the project owner nothing to do. – pholpar Jul 07 '21 at 19:44