Published on

Create File with Special Characters in Power Automate

Authors

Power Automate is a powerful tool that allows you to automate various tasks and workflows. However, sometimes you may encounter some challenges when working with files that contain special characters in their names or paths. For example, if you want to create a file with a name like "Report #1.docx" or "Invoice $100.pdf", you may get an error message saying that the file name is invalid or contains unsupported characters.

This is how:

  1. Create Your flow, In your Power Automate flow, add an action that creates a file in your desired location. For example, you can use the "Create file" action from OneDrive for Business or SharePoint connectors.

  2. Search for the Connector Send an HTTP request to SharePoint

  3. Add these Values:

| Input        | Value                                                                                |
| ------------ | ------------------------------------------------------------------------------------ |
| Site Adress  | Your Site                                                                            |
| Method:      | Post                                                                                 |
| URI:         | \_api/web/lists/getByTitle('YourLibrary')/getitembyid(ItemID)/validateUpdateListItem |
| Header:      |
| accept       | application/JSON; odata=verbose                                                      |
| content-type | application/JSON; odata=verbose                                                      |
| Body         |
{
  "formValues": [
    {
      "__metadata": { "type": "SP.ListItemFormUpdateValue" },
      "FieldName": "FileLeafRef",
      "FieldValue": "FileNameYouWantToUse"
    }
  ],
  "bNewDocumentUpdate": true,
  "checkInComment": "Updated Filename" //This is optional
}

It should look something like this

Image

This will create your Item and then Update it with the correct name!

You should see that your file is created successfully with the original name "Report #1.docx". You can use this method to create files with any special characters in Power Automate.