none
ProjectServer - Sharepoint REST API Updating Custom Fields RRS feed

  • Question

  • Hi All,

    I have been able to use the Rest API To Batch, Create, Update and Delete EnterpriseResources objects through the ProjectServer namespace.

    i.e https://{domain}/sites/DEV/_api/ProjectServer/EnterpriseResources

    However i cannot find anyway (or any documentation) on how to update a Custom Field on the EnterpriseResource through the REST API.

    Does anyone know if this is possible.?The below json seems to be as close as i can get, however it returns a 400 error claiming "open collection properties are not supported"

    {"Custom_x005f_7fe55f85b0b94f9baac0de4142ed1a21": 
    {"__metadata": {"type": "Collection(Edm.String)"}, 
    "results": ["Entry_4ea5c48285b8e81180cd00155dd88908"]}, 
    "__metadata": {"type": "PS.EnterpriseResource"}}
    
    <Response [400]>
    
    {"error":{"code":"-1, 
    Microsoft.SharePoint.Client.InvalidClientQueryException",
    "message":{"lang":"en-US","value":"An open collection property 
    'Custom_x005f_7fe55f85b0b94f9baac0de4142ed1a21' was found. In OData, 
    open collection properties are not supported."}}}

    Below is my test rest request using the python-requests api.

    spSitesHeader["X-HTTP-METHOD"] = "MERGE"
    spSitesHeader["IF-MATCH"] = "*"
    test = requests.Request("PATCH",enterprise_resources["__metadata"]["uri"],
                            data=enterprise_resources_json,
                            headers=spSitesHeader,
                            cookies=cookies)
    rPrep = test.prepare()
    response = s.send(rPrep)

    Any solutions would be greatly appreciated.

    Many Thanks for your help

    Monday, September 23, 2019 3:46 AM

Answers

  • So the process outline (by Martin Laukkanen) in this article works for updating Custom Fields

    https://nearbaseline.com/2018/07/updating-resource-custom-field-values-via-rest-in-microsoft-flow/

    It doesn't look like this is officially supported anywhere as i couldn't find any reference in the documentation to this.

    Hopefully this helps some other people out there stuck with this.

    • Marked as answer by justAnotherDev1 Wednesday, September 25, 2019 1:30 AM
    Wednesday, September 25, 2019 1:30 AM