How do I get current Orchestrator Folder using VB.NET or C# invoke code

Hi guys, how do I get Orchestrator Folder name where the process is running, using or c# code.

In Studio

In Orchestrator

I have never tried this at invoke code activity.
But we can get this information (folder name and folder ID of current run) using UiPath.Robot.Activities.Api namespace (from UiPath.Activities.Api nuget). It is working in activity creator project:

protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
            var apiRuntime = context.GetExtension<IExecutorRuntime>();
            return (ctx) => {
                Result.Set(ctx, apiRuntime.RunningJobInformation.FolderName);
1 Like

Hi @Konrad_Mierzwa , thanks for your response, at least I have some where to start. I’m working on converting it to invoke code (C#)

@Konrad_Mierzwa enjoyed your answer and my collegue did spend sometime to try your answer, but due to some bugs in the new Activity Builder he was not able to get it to work today. Thank you for your inputs anyway.

Hi @wilbardmtei,

If you are flexible looking for solutions other than via or C#, then I have a suggestion using UiPath Orchestrator API.

You can then choose to run it via the robot directly, this way you skip the API authentication part as robot would already have been authenticated.

I could not find a direct way, but due to internal relationships in the API endpoints we can use the QueueDefinitions endpoint to get what you want.

  1. Get all folder details from relative endpoint : “/odata/QueueDefinitions”

  2. Convert string to json object (this needs UiPath.Web.Activities

  3. QueueDefinitionsJson("value")(0)("OrganizationUnitFullyQualifiedName").ToString
    OrganizationUnitFullyQualifiedName is the key containing the folder name. It does not matter which index you go into, the parent folder will not be dynamic because a aueue is always within a parent folder (OrganizationUnitFullyQualifiedName).

Hope this helps you and others!

Here is the sample file :
GetQueuesInfo.xaml (8.4 KB)

Hi @Jeevith , Thanks for your answer, I understand your solution provide folder name which you specify, although i would like to get a folder name that the process is running from.

E.g. you are developing a process on UiPath studio, I want to be able to see which folder name is set when running the process.

Hi @wilbardmtei,

Yes the suggested solution gets you want you want. Have you tried it? It does not hardcode the folder name.

It gets you the folder name where the robot is running from. Both in Studio or in Robot. You will get the current folder name where the process is running.

The endpoint I use there is for Onpremises orchestrator. If you are using cloud Orchestrator, the relative endpoint might be slightly varied.

Hi @jeevith I changed the end-point and it worked. Thanks a lot.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.