- 概要
- カスタム アクティビティ
- アクティビティを .NET 6 に移行する
- リリース ノート
- ワークフロー アナライザーのルールを構築する
- アクティビティ プロジェクト設定の構成
- カスタム ウィザードの作成
- スコープによるアクティビティの優先度設定
- UiPath.Activities.Api.Base
- UiPath.Studio.Activities.Api
- UiPath.Studio.Activities.Api.Activities
- UiPath.Studio.Activities.Api.BusyService
- UiPath.Studio.Activities.Api.ExpressionEditor
- UiPath.Studio.Activities.Api.Expressions
- UiPath.Studio.Activities.Api.Licensing
- UiPath.Studio.Activities.Api.Mocking
- UiPath.Studio.Activities.Api.ObjectLibrary
- UiPath.Studio.Activities.Api.PackageBindings
- UiPath.Studio.Activities.Api.ProjectProperties
- UiPath.Studio.Activities.Api.ScopedActivities
- UiPath.Studio.Activities.Api.Settings
- UiPath.Studio.Activities.Api.Wizards
- UiPath.Studio.Activities.Api.Workflow
- UiPath.Studio.Api.Controls
- UiPath.Studio.Api.Telemetry
- UiPath.Studio.Api.Theme
- Robot JavaScript SDK
- トリガー SDK
- エージェント SDK

開発者ガイド
アクティビティ プロジェクト設定の構成
オフィシャル フィード (https://pkgs.dev.azure.com/uipath/Public.Feeds/_packaging/UiPath-Official/nuget/v3/index.json) から提供される UiPath.Activities.API パッケージを使用して、Studio でアクティビティのカスタム プロジェクト設定を独自に作成、追加できます。 API の使用方法の詳細については、「Studio アクティビティ SDK」をご覧ください。
カスタム プロジェクトでは開発依存関係として UiPath.Activities.API パッケージを使用する必要があります。開発依存関係についてご覧ください。
アクティビティのプロジェクト設定には、[ プロジェクト設定 ] ウィンドウから直接、プロジェクト レベルで調整可能な一連のオプションが含まれます。

アクティビティ設定の作成
以下のサンプルでは、音楽プレイヤーのサンプル アクティビティで使用する一連の設定を作成します。
タブとセクションの追加
using UiPath.Studio.Activities.Api;
using UiPath.Studio.Activities.Api.Settings;
namespace MyCustomActivityPack
{
public static class SettingsCreator
{
// This is the key used to reference a tab, even across packages.
internal const string CategoryKey = "DemoTabUniqueKey";
// This is the key used to reference the setting, even across packages.
internal const string CommentTextKey = CategoryKey + ".Comment";
internal const string PresetKey = CategoryKey + ".Preset";
internal const string ShuffleKey = CategoryKey + ".Shuffle";
public static void CreateSettings(IWorkflowDesignApi workflowDesignApi)
{
var settingsApi = workflowDesignApi.Settings;
// Add the category (a tab in the settings page)
var category = new SettingsCategory()
{
Description = "Settings Sample",
Header = "Settings Sample",
Key = CategoryKey
};
settingsApi.AddCategory(category);
AddMusicPlayerSection(settingsApi, category);
AddMiscSettings(settingsApi, category);
using UiPath.Studio.Activities.Api;
using UiPath.Studio.Activities.Api.Settings;
namespace MyCustomActivityPack
{
public static class SettingsCreator
{
// This is the key used to reference a tab, even across packages.
internal const string CategoryKey = "DemoTabUniqueKey";
// This is the key used to reference the setting, even across packages.
internal const string CommentTextKey = CategoryKey + ".Comment";
internal const string PresetKey = CategoryKey + ".Preset";
internal const string ShuffleKey = CategoryKey + ".Shuffle";
public static void CreateSettings(IWorkflowDesignApi workflowDesignApi)
{
var settingsApi = workflowDesignApi.Settings;
// Add the category (a tab in the settings page)
var category = new SettingsCategory()
{
Description = "Settings Sample",
Header = "Settings Sample",
Key = CategoryKey
};
settingsApi.AddCategory(category);
AddMusicPlayerSection(settingsApi, category);
AddMiscSettings(settingsApi, category);
上記のコードは、[アクティビティのプロジェクト設定] ウィンドウにタブとセクションを追加します。タブのツールチップ上にカーソルを置くと、タブについての説明が表示されます。

設定の追加
- 展開可能な設定セクション
private static SettingsSection AddMusicPlayerSection(IActivitiesSettingsService settingsApi, SettingsCategory category) { var section = new SettingsSection() { Description = "Settings for a music player", IsExpanded = true, //set this to control default expansion Title = "Music Player Settings", // the key of a section has to be unique only within the category Key = "Player" }; settingsApi.AddSection(category, section); AddSimpleBoolean(settingsApi, section); AddSingleChoice(settingsApi, section); return section; }private static SettingsSection AddMusicPlayerSection(IActivitiesSettingsService settingsApi, SettingsCategory category) { var section = new SettingsSection() { Description = "Settings for a music player", IsExpanded = true, //set this to control default expansion Title = "Music Player Settings", // the key of a section has to be unique only within the category Key = "Player" }; settingsApi.AddSection(category, section); AddSimpleBoolean(settingsApi, section); AddSingleChoice(settingsApi, section); return section; }
次のような結果が得られます。

- Boolean 値のラジオ ボタン
private static void AddSimpleBoolean(IActivitiesSettingsService settingsApi, SettingsSection section) { var booleanSetting = new SingleValueEditorDescription<bool> { DefaultValue = true, Description = "If active, the playlist is shuffled", // The value returned by GetDisplayValue should be localized GetDisplayValue = b => b ? "On" : "Off", Key = ShuffleKey, Label = "Shuffle" }; settingsApi.AddSetting(section, booleanSetting); }private static void AddSimpleBoolean(IActivitiesSettingsService settingsApi, SettingsSection section) { var booleanSetting = new SingleValueEditorDescription<bool> { DefaultValue = true, Description = "If active, the playlist is shuffled", // The value returned by GetDisplayValue should be localized GetDisplayValue = b => b ? "On" : "Off", Key = ShuffleKey, Label = "Shuffle" }; settingsApi.AddSetting(section, booleanSetting); }
次のような結果が得られます。

- 複数の値選択リスト
private static void AddSingleChoice(IActivitiesSettingsService settingsApi, SettingsSection category) { var booleanSetting = new SingleValueSelectorDescription { DefaultValue = "pop", Values = new[] { "classic", "pop", "rock" }, Description = "Sample single choice setting", // The value returned by GetDisplayValue should be localized GetDisplayValue = choice => choice + " music", Key = PresetKey, Label = "Mixer Preset" }; settingsApi.AddSetting(category, booleanSetting); }private static void AddSingleChoice(IActivitiesSettingsService settingsApi, SettingsSection category) { var booleanSetting = new SingleValueSelectorDescription { DefaultValue = "pop", Values = new[] { "classic", "pop", "rock" }, Description = "Sample single choice setting", // The value returned by GetDisplayValue should be localized GetDisplayValue = choice => choice + " music", Key = PresetKey, Label = "Mixer Preset" }; settingsApi.AddSetting(category, booleanSetting); }
次のような結果が得られます。

- 検証機能付きのテキスト入力フィールド
private static void AddSimpleString(IActivitiesSettingsService settingsApi, SettingsSection section) { var simpleStringSetting = new SingleValueEditorDescription<string>() { Description = "A free text comment that can't contain the word 'invalid'", // The GetDisplayValue obtains a localized screen representation of the underlying setting value. GetDisplayValue = LocalizeSimpleSettingValue, IsReadOnly = false, DefaultValue = "There is no comment", Label = "Comment", Validate = ValidateSimpleStringSetting, Key = CommentTextKey }; // Add the setting to the section. // A setting may also be directly added on a category. It will appear as a setting without a section (top level setting) settingsApi.AddSetting(section, simpleStringSetting); } private static string LocalizeSimpleSettingValue(string s) => $"A localized value of <code>{s}</code>"; private static string ValidateSimpleStringSetting(string arg) { if (arg?.ToLowerInvariant().Contains("invalid") == true) { return "The sample string setting is invalid if it contains the <code>invalid</code> keyword"; } return string.Empty; }private static void AddSimpleString(IActivitiesSettingsService settingsApi, SettingsSection section) { var simpleStringSetting = new SingleValueEditorDescription<string>() { Description = "A free text comment that can't contain the word 'invalid'", // The GetDisplayValue obtains a localized screen representation of the underlying setting value. GetDisplayValue = LocalizeSimpleSettingValue, IsReadOnly = false, DefaultValue = "There is no comment", Label = "Comment", Validate = ValidateSimpleStringSetting, Key = CommentTextKey }; // Add the setting to the section. // A setting may also be directly added on a category. It will appear as a setting without a section (top level setting) settingsApi.AddSetting(section, simpleStringSetting); } private static string LocalizeSimpleSettingValue(string s) => $"A localized value of <code>{s}</code>"; private static string ValidateSimpleStringSetting(string arg) { if (arg?.ToLowerInvariant().Contains("invalid") == true) { return "The sample string setting is invalid if it contains the <code>invalid</code> keyword"; } return string.Empty; }
次のような結果が得られます。

プロセス ID とログを取得する
IExecutorRuntime 参照に適用されるメソッドを使用して、ロボットが実行中のプロセスの ID 情報と実行ログを取得できます。以下のメソッドを使用できます。
IRunningJobInformation- 実行中のプロセスに関する情報を収集します。以下のプロパティをサポートしています。JobID- プロセス ID を取得します。ProcessName- プロセス名を取得します。ProcessVersion- プロセスのバージョンを取得します。WorkflowFilePath- プロセスのフル パスを取得します。InitiatedBy- ジョブのソース (Robot、Studio、Orchestrator など) を取得します。FolderId- プロセスのフォルダー ID を取得します。FolderName- プロセスのフォルダー名を取得します。TenantId- テナント ID を取得します。TenantKey- テナント キーを取得します。TenantName- テナント名を取得します。RobotName- ロボット名を取得します。LicenseType- ロボットのライセンスの種類を取得します。RuntimeGovernanceEnabled- ランタイム ガバナンスが有効化されているかどうかを確認する情報を提供します。InternalArguments- プロセスの内部引数を取得します。OrganizationId- 組織 ID を取得します。PictureInPictureMode- 使用するピクチャ イン ピクチャ モードの種類を取得します。 次の値を使用できます。Main- プロセスはメインの Windows セッションで実行されます。PictureInPictureSession- プロセスは PiP セッションで実行されます。PictureInPictureDesktop- プロセスが PiP 仮想デスクトップ モードで実行されます。
LogMessage- 指定した ログ レベル に従って ロボット実行ログ を生成します。ログの詳細については、 こちらのページをご覧ください。次のプロパティがサポートされています。EventType- 取得するログ レベルです。Message- 表示するメッセージです。
次のコードは、LogMessage メソッドの使用例です。
public class MyLogMessageActivity : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
var executorRuntime = context.GetExtension<IExecutorRuntime>();
var jobInfo = executorRuntime.RunningJobInformation;
executorRuntime.LogMessage(new LogMessage
{
EventType = TraceEventType.Warning,
Message = $"Job {jobInfo.JobId}: My log message from workflow {jobInfo.WorkflowFilePath}"
});
}
}
public class MyLogMessageActivity : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
var executorRuntime = context.GetExtension<IExecutorRuntime>();
var jobInfo = executorRuntime.RunningJobInformation;
executorRuntime.LogMessage(new LogMessage
{
EventType = TraceEventType.Warning,
Message = $"Job {jobInfo.JobId}: My log message from workflow {jobInfo.WorkflowFilePath}"
});
}
}
Studio へのプロジェクトの追加
Studio の [アクティビティのプロジェクト設定] ウィンドウに設定を表示させるには、カスタム アクティビティを NuGet パッケージにパブリッシュして、このパッケージを Studio バージョン 2019.10.1 以降で定義したフィードで利用できるようにする必要があります。
NuGet パッケージの作成

- NuGet Package Explorer を起動します。
- [Create a new package] (Ctrl + N) をクリックします。[Package metadata] と、[Package contents] を示す分割ウィンドウが表示されます。後者のセクションに、すべての依存関係を追加する必要があります。
- [Package contents] セクションを右クリックします。コンテキスト メニューが表示されます。
- [Add lib folder] をクリックします。新しい [lib] 項目が、[Package contents] セクションに作成されます。
- [lib] を右クリックして、[Add Existing File…] を選択します。
- プロジェクトの外部アセンブリ (.dll) を読み込みます。
- [Edit] > [Edit Metadata] をクリックします。[Package metadata] セクションが表示されます。
- プロジェクトの適切な説明をフィールドに入力します。
- [Id] フィールドに入力し、キーワード Activities が含まれていることを確認します。これにより、Studio の [パッケージを管理] ウィンドウにパッケージが表示されるようになります。
- [File] > [Save] をクリックします。このケースでは、
.nupkgファイルが作成されます。注:アクティビティには、直感的なフォルダー構造を作成してください。Orchestrator で使用すると、カスタム アクティビティ内の空のフォルダーはすべて削除されます。
UiPath Studio への NuGet パッケージのインストール
.nupkg ファイルを作成したら、こちらの説明に従い、これを Studio のカスタム フィードに追加します。
[ パッケージを管理 ] ウィンドウを開き、パッケージをインストールします。カスタム フィードが Studio で有効化されていることを確認します。
設定例
上記で作成したタブ、セクション、および設定をまとめて、[アクティビティのプロジェクト設定] ウィンドウに表示します。

以下のリンクからサンプルをダウンロードしてください。このサンプルには、 カスタム ウィザードの作成例も含まれています。