22.5 Coded Automation Services: Orchestrator, UI Automation, Microsoft 365 & Custom Services

Key Takeaways

  • Services correspond to activity packages, such as system, uiAutomation, testing, Mail, Excel, GSuite, and Microsoft 365, and are called as service.API.

  • BuildClient returns an HttpClient authorized for the Orchestrator API, and GetRunningJobInformation describes the running job.

  • uiAutomation.Open and Attach work with Object Repository descriptors (also from libraries), and Target.FromSelector supports native selectors.

  • Connected services use the connections object, whose connections can be overridden in Orchestrator.

  • Custom services are an interface and implementation in code source files, exposed through the CodedWorkflow partial class and RegisterServices.

Last updated: September 2026

22.5 Coded Automation Services: Orchestrator, UI Automation, Microsoft 365 & Custom Services

Core Concept: In coded automations, services are the equivalent of activity packages, and their coded automation APIs are the equivalent of activities. The exam description lists coded workflow topics: arguments, Orchestrator and UI Automation services, Microsoft 365, hybrid workflows, custom services, and imported libraries. This section focuses on the services and how they combine with low-code work.


Services and How to Call Them

ServicePackage (minimum version for coded use)
systemSystem.Activities 23.10.2
uiAutomationUIAutomation.Activities 23.10.3
testingTesting.Activities 23.10.0
Mobile automationMobileAutomation.Activities 24.10.0
MailMail.Activities 1.22.1
ExcelExcel.Activities 2.24.1
Google WorkspaceGSuite.Activities 2.6.21
PresentationsPresentations.Activities 1.14.1
Microsoft 365MicrosoftOffice365.Activities 2.6.21

Install the activity package, then call its APIs in the form service.API(...). Parameters replace activity properties. For example, system.GetAsset("Email Address") reads an Orchestrator asset. You can also use any .NET library from nuget.org.


Orchestrator from Code

  • The system service offers Orchestrator-related APIs such as reading assets and credentials and working with queue items, just as the System activities do.
  • For Orchestrator endpoints without a dedicated API, BuildClient() builds an HttpClient with an access token for the Orchestrator scope, so code can call the Orchestrator API directly.
  • GetRunningJobInformation() returns details of the current job, and Log(...) writes log messages, optionally with additional log fields.

UI Automation from Code

UI Automation APIs work with Object Repository descriptors or with selectors:

var login = uiAutomation.Open(AcmeApp.Acme.LoginScreen);
login.TypeInto(AcmeApp.Acme.LoginScreen.Email, "john.doe2023@uipath.com");
login.Click(Target.FromSelector("<webctrl tag='BUTTON' type='submit'/>"));

var dashboard = uiAutomation.Attach(AcmeApp.Acme.Dashboard);
dashboard.Click(AcmeApp.Acme.Dashboard.Students);
  • Open starts or opens the application at a screen; Attach connects to a screen that is already open.
  • Overloads that take IScreenDescriptor or IElementDescriptor use Object Repository elements.
  • Overloads that take TargetAnchorableModel work with native selectors, for example from Target.FromSelector(...) with a selector copied from UI Explorer.

Object Repository elements can come from the project or from an imported library.


Microsoft 365, Google Workspace, and Other Connected Services

Services that use Integration Service connections are reached through the connections object:

  1. Create the connection (for example Microsoft Office 365 or Gmail) in the same organization and tenant.
  2. In code, type connections. and choose the type, such as O365Mail, OneDrive, Excel, Gmail, GDrive, or GoogleSheets.
  3. Select the specific connection, whose name combines the folder and the account, for example connections.Gmail.My_Workspace_john_doe_gmail_com.
  4. Store it in a variable in one step, var mail = connections.O365Mail.<folder>_<account>;, and call the service's APIs through it.

After publishing, the connection can be overridden in Orchestrator for each environment.


Imported Libraries

Install a library project as a package, and its reusable assets become available in coded automations:

  • Object Repository elements, for use with uiAutomation.Open and Attach.
  • Workflows, both low-code .xaml and coded .cs, which you can invoke from code.

This lets one team own the UI descriptors and shared workflows while other projects consume them.


Custom Services

Register your own services to use them in every coded file of the project:

  1. In a code source file, declare an interface, for example IMyService with DoMyMethod().
  2. Implement it in a class, such as MyService : IMyService.
  3. Extend the CodedWorkflow partial class in another code source file with a property, for example public IMyService myService { get => serviceContainer.Resolve<IMyService>(); }.
  4. Override RegisterServices to register the implementation with the service locator.

Every coded workflow can now call myService.DoMyMethod().


Before and After Runs

Coded test cases can run setup and cleanup code by implementing the before and after interface on the partial class, for example to open an application before each test and close it afterwards.


A Hybrid Design

PartChoice
Process flow and REFramework statesLow-code
Parsing, validation rules, and calculationsCode source files and coded workflows
UI stepsLow-code activities or uiAutomation with shared Object Repository descriptors
Email and files in Microsoft 365Connector activities, or the connections object in code
Shared helpers used across projectsA library with coded source files and descriptors

Common Traps

  • Looking for an ui service: the UI Automation service in code is uiAutomation.
  • Using a connection name typed by hand instead of choosing it from connections. IntelliSense, which encodes the folder and account.
  • Calling Open when the application is already running, instead of Attach.
  • Registering a custom service without exposing it through the CodedWorkflow partial class, so coded files cannot reach it.
  • Forgetting that a service is available only after installing its activity package at a version that supports coded automations.
Test Your Knowledge

In a coded workflow, how is the Orchestrator asset "Email Address" read?

A

GetAsset.Execute("Email Address")

B

orchestrator.Assets["Email Address"]

C

system.GetAsset("Email Address")

D

Config("Email Address")

Test Your Knowledge

Which UI Automation API connects to an application screen that is already open?

A

uiAutomation.Attach, with the screen's Object Repository descriptor

B

uiAutomation.Open, which always restarts the application

C

system.RunWorkflow

D

Target.FromSelector

Test Your Knowledge

How does a coded workflow use a Gmail connection created in Integration Service?

A

Through the connections object, selecting the Gmail connection by folder and account, and calling the service APIs on it.

B

By storing the Gmail password in a Credential asset.

C

Through BuildClient with the Gmail scope.

D

Coded workflows cannot use connections.

Sections you finish are checked off in the contents.