0

I am receiving a 400 Status error with my Power Automate app. I am unsure as to why, it seems there's an issue with my current code but unfortunately, I am unable to find it.

Power Automate App Creation

For Convert to PDF, the expression is:

replace(triggerBody()?['{Path}'], 'Working/', '')

And, for the Sent to HTTP Post I the expression is:

replace(toUpper(body('Get_file_metadata')?['Name']), '.DOCX', '.pdf')

Also, the status message output I receive is the following:

{
    "statusCode": 400,
    "headers": {
        "Pragma": "no-cache",
        "x-ms-request-id": "8432469a0-d0c2-1100-8ji4-8e49fe65306e",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Cache-Control": "no-store, no-cache",
        "Set-Cookie": "ARRAffinity=473c817130901edebb081d9a6ffdc67a5853b67fcdd59faa18c8da1e3d4f4c1a;Path=/;HttpOnly;Secure;Domain=sharepointonline-ase.azconn-ase.p.azurewebsites.net,ARRAffinitySameSite=473c817130fdc67901edebb081d9a6f a5853b67fcdd59faa18c8da1e3d4f4c1a;Path=/;HttpOnly;SameSite=None;Secure;Domain=sharepointonline-ase.azconn-ase.p.azurewebsites.net",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "x-ms-apihub-obo": "true",
        "Date": "Tue, 20 Aug 2022 13:20:48 GMT",
        "Content-Length": "495",
        "Content-Type": "application/json",
        "Expires": "-1"
    },
    "body": {
        "status": 400,
        "message": "Server relative urls must start with SPWeb.ServerRelativeUrl\r\nclientRequestId: df231d17-ddff-3f7f-85ca-f0624ddda688\r\nserviceRequestId: 842329a0-d0b2-1080-8ec4-8e49fe26306b",
        "source": "https://consonto.sharepoint.com/sites/CONSONTOTESTUAT/_api/web/getFileByServerRelativeUrl('/DocumentLibrary1/Communications1/file.docx')/copyTo(strNewUrl=DocumentLibrary2/Communications2/file.pdf',bOverWrite=true)",
        "errors": [
            "-2147024809",
            "System.ArgumentException"
        ]
    }
}

Please let me know what I can do to change it.

1
  • Hi, did you try my solution given below? let me know if you need any further help with this. Oct 13, 2022 at 11:09

1 Answer 1

0

Existing file path URL in getFileByServerRelativeUrl() endpoint should be in below format:

/sites/siteName/libraryName/folderName/fileName.pdf

Use correct path in "Send an HTTP request to SharePoint" action and it should work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.