What is imports?

Hi

I would like to ask what imports are in studio.

I understand what variables and arguments are but need more clarification on what exactly imports are.

Thank you!

@sk1412p Refer below link

About Imported Namespaces

Thank you for the link but I am not sure what Namespaces are.

Thank you!

@sk1412p Before Importing Namespace

                                       **After Importing Namespace**

Before importing System.Text.RegularExpression we cannot use Regex.Match Method

Here System is a namespace (that is used to logical division of class)
Regex is a Class
Match is a method

Check attached file for reference RegexExample.xaml (5.4 KB)

4 Likes

Thank you for your help.

So I understand how after importing System.Text.RegularExpression, we can use Regex.Match method so namespace is something that facilitates the use of data?

I want to know what exactly namespace/imports are. Thank you

@sk1412p Follow this link

Hi,

There’s some variable type that I need to use and it’s not being displayed on the dropdown list. To my understanding, adding it to the imports should make it availabe, but it’s not there. I’ve done some attempts editing the XML file in a text editor and adding it as an (doing my best to try to find out what the proper one is), but that doesn’t make a difference. I’m using some Powershell methods that return specific types and I need to specify this on the output variable type, in order to be able to use it. Any hints?

What type are trying to use?

Edit: In case it’s not included in Studio by default, you need to add the package as a dependency.

@pere

Hi @efelantti and thanks for the reply,

As I posted in another thread, the type is of “” and it looks like this:

 TeamSettings 
  {
    AllowAddRemoveApps=true,
    AllowChannelMentions=true,
    AllowCreatePrivateChannels=true,
    AllowCreateUpdateChannels=true,
    AllowCreateUpdateRemoveConnectors=true,
    AllowCreateUpdateRemoveTabs=true,
    AllowCustomMemes=true,
    AllowDeleteChannels=true,
    AllowGiphy=true,
    AllowGuestCreateUpdateChannels=false,
    AllowGuestDeleteChannels=false,
    AllowOwnerDeleteMessages=true,
    AllowStickersAndMemes=true,
    AllowTeamMentions=true,
    AllowUserDeleteMessages=true,
    AllowUserEditMessages=true,
    Archived=false,
    Classification=null,
    Description="A random group",
    DisplayName="PKO5PL21265630",
    GiphyContentRating=moderate,
    GroupId="beaf6-aa6-17d0-9269-dagyu9087456dhazadg",
    InternalId="19:XJXx5fdhdfhYW3-yqtxn4Fdsgfj567idLkhC5OzNWr8MqnpaE1@thread.tdsga",
    MailNickName="msteams_9807fh",
    ShowInTeamsSearchAndSuggestions=false,
    Visibility="Private" 
  }

It’s a Microsoft Teams Power Shell connector related one.

But what if there is no related package available?

There’s a UiPath.MicrosoftTeams.Activities package, and in fact I installed it, but I don’t know how to use, neither if it will work for me.

You could use the activities from this package to automate Teams, instead of PowerShell, if that’s an option for you. If you want to use PowerShell, I think it wouldn’t be of help.

I’m afraid I don’t have that much experience with PowerShell. But, I wonder if the output could be cast to PSObject ( PSObject Class (System.Management.Automation) | Microsoft Learn - https://learn.microsoft.com/)? In that case, you might be able to access the output variable’s attributes like in this SO answer: powershell - Access PSObject property by name in C# - Stack Overflow.

Hi @efelantti ; I really appreciate your efforts.

I tried the casting to PSObject approach you suggested in several ways and/or variations, like trying to assign the output of the Power Shell activity to that type, instead of a plain object, and it didn’t work - but the results are very weird in the sense that it doesn’t complain, no errors or exceptions whatsoever, but the contents of the variable are always null (I’ve tried it several times from scratch to assure that I wasn’t doing something different).

Then, setting the type as plain object, then trying to cast the variable (I’m doing it explicitly via a DirectCast(myVar, PSObject)) throws an error.

My last option is to parse the .toString() text of the object approach, but that’s pretty ugly.

One more idea - can you try setting the output to Collection<PSObject>?