cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gottijay2000
Advocate II
Advocate II

Get list of Emails from a SharePoint List of Users

i have a SharePoint List('Admin Users') which basically has one column that is a people field(User). i want to be able to extract the emails into the app as a Table with one column where each value is the email of the user.

 

Any ideas?

2 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@Gottijay2000 

For example, let's say your SharePoint List 'Admin Users' looks like this.  Username is a People type column.

 

Username
Anne Black
Kelly Johnson
Jessica Finch 

 

To make a collection holding the email of each user you can use this code in the OnVisible property of the screen.

Clear(myEmailsList);
ForAll('Admin Users', Collect(myEmailsList,{Value: Username.Email}))

 

Now if you create a Data Table and put this code in the Items property...

myEmailsList

 

...The Data Table will look like this in your app.

 

Value
ablack@yourcompany.com
kjohnson@yourcompany.com
jfinch@yourcompany.com

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @Gottijay2000 ,

Do you want to get a one column table where each value is the email addresses of the user in 'Admin Users'?

Can you tell me whether the person field(User) allows multiple people?

Ive made a similar test for your reference:

Case 1: The person field(User) does not allow multiple people.

1\ Add a button control and set the controls OnSelect property to:

Clear(Emailofusers);         /* ‘Emailofusers’ is a collection that will be created by the following code*/ /*Clear the collection ‘Emailofusers’ before getting the data*/

ForAll(                           /*traversal each records of 'Admin Users'*/

    'Admin Users',

    Collect(

        Emailofusers,        

        {emailaddress: User.Email}    /*get the email of user*/ /*User is the column name of the people field(User)*/

    )
)

2\ You will get a one column table(Emailofusers) where each value is the email of the user by clicking the button.

 

Case 2: The person field(User) allows multiple people.

1\ Add a button control and set the controls OnSelect property to:

Clear(Emailofusers);              /* ‘Emailofusers’ is a collection that will be created by the following code*/  /*Clear the collection ‘Emailofusers’ before getting the data*/           

ForAll(                         /*traversal each records of 'Admin Users'*/

    'Admin Users',

    ForAll(                     /*traversal each records of ‘User’*/

        User,

        Collect(

            Emailofusers,

            {emailaddress: Email}        /*get the email of user*/  

        )

    )

)

2\ You will get a one column table(Emailofusers) where each value is the email of the user by clicking the button.

 

 

394.jpg

 

If you still have any question please dont hesitate to let us know.

 

 

Best Regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@Gottijay2000 

For example, let's say your SharePoint List 'Admin Users' looks like this.  Username is a People type column.

 

Username
Anne Black
Kelly Johnson
Jessica Finch 

 

To make a collection holding the email of each user you can use this code in the OnVisible property of the screen.

Clear(myEmailsList);
ForAll('Admin Users', Collect(myEmailsList,{Value: Username.Email}))

 

Now if you create a Data Table and put this code in the Items property...

myEmailsList

 

...The Data Table will look like this in your app.

 

Value
ablack@yourcompany.com
kjohnson@yourcompany.com
jfinch@yourcompany.com

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

v-yutliu-msft
Community Support
Community Support

Hi @Gottijay2000 ,

Do you want to get a one column table where each value is the email addresses of the user in 'Admin Users'?

Can you tell me whether the person field(User) allows multiple people?

Ive made a similar test for your reference:

Case 1: The person field(User) does not allow multiple people.

1\ Add a button control and set the controls OnSelect property to:

Clear(Emailofusers);         /* ‘Emailofusers’ is a collection that will be created by the following code*/ /*Clear the collection ‘Emailofusers’ before getting the data*/

ForAll(                           /*traversal each records of 'Admin Users'*/

    'Admin Users',

    Collect(

        Emailofusers,        

        {emailaddress: User.Email}    /*get the email of user*/ /*User is the column name of the people field(User)*/

    )
)

2\ You will get a one column table(Emailofusers) where each value is the email of the user by clicking the button.

 

Case 2: The person field(User) allows multiple people.

1\ Add a button control and set the controls OnSelect property to:

Clear(Emailofusers);              /* ‘Emailofusers’ is a collection that will be created by the following code*/  /*Clear the collection ‘Emailofusers’ before getting the data*/           

ForAll(                         /*traversal each records of 'Admin Users'*/

    'Admin Users',

    ForAll(                     /*traversal each records of ‘User’*/

        User,

        Collect(

            Emailofusers,

            {emailaddress: Email}        /*get the email of user*/  

        )

    )

)

2\ You will get a one column table(Emailofusers) where each value is the email of the user by clicking the button.

 

 

394.jpg

 

If you still have any question please dont hesitate to let us know.

 

 

Best Regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@mdevaney @v-yutliu-msft 

thanks again for your help. This worked great

THANK YOU GURU I have searched high and low for hours on how to get this exact answer - there is zero out there that I could find except for this post to ansewer "How to I collect the email adress of each person in a SharePoint list column of type'Person' where you can cave multiple users.

I registered just to kudos and reply as I am so very grateful. There is so little info on this, and if so, nothing with such a generous explanatory working sample.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,503)