- Visão geral
- Funções do Python
- Implantar e executar
Declare an Orchestrator or Integration Service resource in bindings.json, verify it resolves during a local run, and make it remappable across tenants.
bindings.json is maintained by hand: uipath init creates the file with the required structure when it is absent, and leaves an existing file untouched. Declare a binding for every platform resource your function reaches, so the resource can be remapped when the package runs in another tenant. For the resolution mechanism behind this, see Resource bindings.
Pré-requisitos
- A Python function project created with
uipath new. - An authenticated session, established with
uipath auth. - The resource already exists in the tenant you develop against.
- The UiPath CLI (
uip) is installed, for the connection lookup in step 1.
Declare a connection binding
-
Retrieve the connection id from Integration Service:
uip is connections list uipath-microsoft-outlook365uip is connections list uipath-microsoft-outlook365 -
Open
bindings.jsonat the project root. -
Add an entry to the
resourcesarray, using the connection id for bothkeyandConnectionId.defaultValue:{ "resource": "connection", "key": "<connection-id>", "value": { "ConnectionId": { "defaultValue": "<connection-id>", "isExpression": false, "displayName": "Microsoft Outlook 365 Connection" }, "Connector": { "defaultValue": "uipath-microsoft-outlook365", "isExpression": false, "displayName": "Connector" } }, "metadata": { "Connector": "uipath-microsoft-outlook365", "UseConnectionService": "True", "BindingsVersion": "2.2" } }{ "resource": "connection", "key": "<connection-id>", "value": { "ConnectionId": { "defaultValue": "<connection-id>", "isExpression": false, "displayName": "Microsoft Outlook 365 Connection" }, "Connector": { "defaultValue": "uipath-microsoft-outlook365", "isExpression": false, "displayName": "Connector" } }, "metadata": { "Connector": "uipath-microsoft-outlook365", "UseConnectionService": "True", "BindingsVersion": "2.2" } } -
Declare the same id as a module-level constant in your function, and pass it to the SDK call:
OUTLOOK_CONNECTION_KEY = "<connection-id>" conn = sdk.connections.retrieve(OUTLOOK_CONNECTION_KEY)OUTLOOK_CONNECTION_KEY = "<connection-id>" conn = sdk.connections.retrieve(OUTLOOK_CONNECTION_KEY) -
Run the function locally:
uipath run main -f input.jsonuipath run main -f input.json
Resultado
The run log contains one line per declared binding:
No resource overwrite matched for connection key='connection.<connection-id>' on retrieve
No resource overwrite matched for connection key='connection.<connection-id>' on retrieve
This line confirms the override lookup ran and fell back to the design-time id, which is the expected outcome locally because no tenant mapping exists. If the line names a different id than the one in bindings.json, the code constant and the binding disagree.
Declaring bindings for other resource types follows the same pattern with a different value shape. Assets, buckets, queues, processes, apps, and indexes use name and folderPath instead of ConnectionId, and their key joins the two with a dot.
Make the binding remappable across tenants
-
Register the function project in a solution:
uip solution project add ./my-solution/my-functionuip solution project add ./my-solution/my-function -
Sync the solution's resource list from the project's declared bindings:
uip solution resource refreshuip solution resource refresh -
Review the resulting resource list:
uip solution resource list --source localuip solution resource list --source local
Resultado
Every declared binding appears in the solution's local resource list. Deployment maps each entry to a resource in the target tenant, so the same package runs against that tenant's own connection. For packaging and publishing the solution, see uip solution pack.
A binding that is not mapped in the target tenant does not fail the job. The call falls back to the design-time identifier, so verify that every binding appears in the target tenant's resource mapping before promoting a solution.
Próximas Etapas
- Call an Integration Service activity — use a declared connection to reach a connector operation.
- Packaging and publishing — deploy the function to Orchestrator.