Custom Activities - folder names and more than one activity in folder

Hello!
I’m learning how to do custom activities, and now i’m wondering how to do two things:

  1. For the first, i want to add more than one activity, and they show on the list like this (img1), and is it possible to have it all in one folder? Code on img2.
  2. How to change name of folder (or name of activity in Ui path) to have for example Folder custom activities and inside activities with custom names?

Thanks for Your help! :slight_smile:

Hi @andrusek

In order to have all activities in a single category you need to set the Category attribute of the activity in its metadata.
This can easily be done from the DesignerMetadata class.

public partial class DesignerMetadata : IRegisterMetadata
{
     public void Register()
     {
         var builder = new AttributeTableBuilder();
         AddCategoryAttribute(builder);
      }

     private void AddCategoryAttribute(AttributeTableBuilder builder)
     {
              builder.AddCustomAttributes(typeof(Doge), new CategoryAttribute("Doge"));
              builder.AddCustomAttributes(typeof(Doge2), new CategoryAttribute("Doge"));
     }
}
3 Likes

Hi @andraciorici, thank you very much for your answer!

In the weekend i found solution looking lie this:

[Category("New Activities")]
[DisplayName("Get names of sheets from excel file")]
[Description("Gets excel file, and outputs list of sheets as a list of strings.")]
public class GetSheetNames : CodeActivity {}

Its surly more primitive, but works. Anyway I will try Your solution, looks much better and optimal :slight_smile:

Thank You!!

greetings!

1 Like

@andraciorici,

Where exactly should i put code from your post?

Tried everywhere but cant make it working :frowning:

Greetings!

In DesignerMetadata class. Here you can find an example.

Didn’t your code work?

Just as a sidenote for other readers:

If you don’t specify a category, it will use namespace for the category, see Microsoft.Activities.Extensions.Statements.AddToDictionary as example.

If you do specify it, remember you can specify additional levels of categorization, by separating each level with dot (same as with namespace levels).

1 Like

@andraciorici, @andrzej.kniola
Thx guys!!!

@andrzej, yep I did it! It works with a dot, and as you said when its problem it names folder like the namespace.

Thank You very much!!