My required variable type for return is not available when invoking Power Shell

Hi,

I’m doing some Microsoft Teams automation, so I’m using some Power Shell-related commands that are available after installing the required connector.

Executing single commands with parameters is working somehow fine after some trial and error. The problem comes when I need to grab the output of one of those commands I run.

For instance, I create a Teams group. Then next task is to add users to it, which is straightforward. But I need the ID of the group I created with the previous command, and there’s no way I can accomplish this. Power Shell command both outputs that info on the screen as a formatted text and, according to the Invoke Power Shell activity, it’s available in the form of an output variable.

I’m attaching a screenshot. There’s a “TypeArgument” dropdown, where you select the type. Then, below, there’s an “Output” textinput, so you write there the name of the variable where that output is gonna be stored (you are supposed to define it in the same scope). Of course both need to be of the same type. But the only that works for me is selecting some generic, as Object, then using the “ToString” method, and I can see the attributes, in a sort of Json format (to be more precise, it’s a collection, with only one member, then after accessing it I’ll have access to the object and its attributes).

The outputted variable type its of “TeamSettings”, and this is the info I get when I use the ToString() method:

Collection<object>(1) 
{
  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" 
  }
}

I need to access the GroupId property. The type “TeamSettings” is not available in the dropdown list for selecting the variable type. So I cannot simply do a whateverMyVariableOfTeamSettingsType.getGroupId() or so.

To my understanding, adding it to the imports should make it available, but it’s not there. I’ve done some attempts editing the XML file in a text editor and adding it as an assembly via <AssemblyReference> (doing my best to try to find out what the proper one is, which isn’t either an easy task, as there’s no hint for it in the Microsoft docs), but that doesn’t make a difference.

In my desperation, as you can notice in the screenshot, I tried to serialize it to Json, but it’s not really Json and it didn’t work.

I can parse that text somehow and get the property data I need, but anyway it doesn’t feel like the proper thing to do, plus it won’t work in the long term when the property is not simply a string.

Any hints?