How to prevent Orchestrator from changing folder ID?
Issue Description: How to prevent Orchestrator from changing folder id (X-UiPath-OrganizationUnitId)? Is there a setting in Orchestrator to keep the folder id persistent?
For some reason the folder Id changes itself, which causes all the Orchestrator API calls to not work with error "Folder does not exist or the user does not have access to the folder".
Resolution:
For accessing resources in a folder, each request must contain either the FolderId, FolderPath, or FolderKey in an HTTP header. This header may be encoded (using Base64 UTF-16LE encoding) or plain text.
For example:
- X-UIPATH-OrganizationUnitId "FolderId",
- X-UIPATH-FolderPath-Encoded "{Encoded FolderPath value}",
- X-UIPATH-FolderPath "PlainText FolderPath value", or
- X-UIPATH-FolderKey "FolderKey".
The FolderId can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Id” value, or from the Orchestrator URL - https://your-domain-server.com/?fid=2032&tid=8. FolderId is of type Int64.
The FolderKey can be obtained by performing a GET request to the /odata/Folders endpoint and copying the “Key” value. FolderKey is of type Unique Id/String.
If the licensing plan is changed for the Orchestrator account (for example, from Enterprise Trial to Enterprise), the FolderId value also changes, whereas the FolderKey value remains the same.
If upgraded and had Organization Units enabled in the previous Orchestrator instance, each OU is migrated as a new Classic folder.
Relative folder paths are supported in an X-UIPATH-FolderPath-Encoded header, as follows:
- Path starting with / - starts from the root folder of the tree the ambient folder is part of.
- Path starting with . - starts from the ambient folder.
- Path starting with .. - starts one level up in the hierarchy of the ambient folder for each .. in the path (e.g. ../ for one level up, ../../ for two levels up in the hierarchy).
Note: Trailing slashes are not accepted. Reference Orchestrator - Building API Requests
In conclusion, do not use X-UiPath-OrganizationUnitId values, but use only X-UiPath-FolderKey (Key), as the FolderKey value remains the same.