cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pathum1
Frequent Visitor

Unable to Search for users

I have a flow which outputs full names of users. I need to get the UPN of these users, however as shown in the figure I am unable to get them using Search for Users. It outputs a null value. I would really appreciate someone's help here.Screenshot 2022-05-02 143251.png

8 REPLIES 8
Heartholme
Continued Contributor
Continued Contributor

Hi @Pathum1 ,

 

The issue here is that you are searching on multiple names at once.

 

Try the following;

 

Initialize an array and if possible add the names to the array, and then select the variable as the output and currentitem in the office search:

Heartholme_1-1651492185773.png

 

{ Please click Accept as solution ✔ if my post answered your question. }
{ This will in turn help others find solutions to similar questions. }

Best Regards
Heartholme

 

 

 

Thank you for this! 

So my flow is designed in a way where it outputs either one, two, or three names (or none) separated by commas as a string. How can i add them into an Array as separate items?

Heartholme
Continued Contributor
Continued Contributor

@Pathum1

 

You already have your compose_3 in an array format. So in the start of the flow initialize a variable as an vArray and then append compose_3 into an array.

 

Then use the append to array inside the apply to each.

 

Let me know how this goes 😊

Pathum1
Frequent Visitor

Hi, 

 

I get the following error when i try to append compose_3 into an array

 

..............  of type 'Array' cannot be appended to the variable 'vArray' of type 'Array'. The action type 'AppendToArrayVariable' only supports values of types 'Float, Integer, String, Boolean, Object'.

Heartholme
Continued Contributor
Continued Contributor

Oh right, forgot that this dosen't work when your output already is an array. Remove the brackets from the initiate variable, and use a set variable with your compose instead of append to array, that should work. 

 

I see that you get the new line ("/n") in your compose as well, so add these steps before you take it into the set variable:

See @tom_riha 's post on this: https://tomriha.com/how-to-replace-new-line-n-in-a-power-automate-expression/

 

If you have any questions, please let me know 😊

 

In terms of your flow:

Heartholme_0-1651520909738.png

Then the last compose goes into the set variable.

Pathum1
Frequent Visitor

Whilst thanking your for the amazing insight, I feel like I need to provide a better background of my issue in hope of getting my issue resolved.

 

So i've got an excel sheet which I import to my Sharepoint List. In this list there is a column named "Auditors" which can contain multiple values or no values at all. There are currently around 60 records in this list.

Sharepoint-column.png

I need to convert these to obtain the O365 UPNs in order for my Powerapp to filter the content associated to the particular user.

Below is the result of me running APPLY TO EACH using the value list of the aforementioned Sharepoint List and composing the values of the "Auditors" column.

Pathum1_0-1651570271791.png

 

Below is the raw output of the above Compose.

 

Pathum1_1-1651570794504.png

So I try to clean it up with the replace expression and below is the result (Compose 3)

Pathum1_2-1651571200808.png

Below is the raw output of Compose 3

Pathum1_3-1651571417437.png

Now all I want to do is pass these names through SEARCH FOR USERS (V2) for the entire 60 odd records I have in my sharepoint list and then record the UPNs in another Column that can be used by powerapps.

 

I hope I gave some more context to my problem. The whole array business is a little unclear to me.

Thanks again for trying help!

 

 

 

Heartholme
Continued Contributor
Continued Contributor

@Pathum1 

 

Sorry for the late reply, I have been quite preoccupied with work lately.

 

What you want to achieve is to have only the names in an array.

 

This should help you out:

Heartholme_0-1651777522047.png

 

First you have your starting input. Note, I included the team leader/member/observer, but you just use the replace you have to filter these out and just have the names.

 

Then use the NewL and compose to remove the new lines from the output, since this will cause the "\n" to mess up your search.

 

Code for these

NewL variable with an enter/lineshift in the text:

Heartholme_1-1651778003495.png

Then this compose which takes your 'final' compose with only the names:

replace(outputs('Compose_3'),variables('NewL'),';')

 

This will replace each new line with an ";".

 

Then split the output of that compose with an

split(outputs('compose'),';'), in order to create an array from the compose:

Heartholme_2-1651778157841.png

Then use an apply to each, to iterate through each name, and update an sharepoint list with the information:

Heartholme_4-1651778771472.png

 

Let me know if you have any more issues 😊

 

{ Please click Accept as solution ✔ if my post answered your question. }
{ This will in turn help others find solutions to similar questions. }

Best Regards
Heartholme

 

 

 

Heartholme
Continued Contributor
Continued Contributor

@Pathum1

 

Were you able to get further with this? 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,798)