web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Checking if a Person i...
Power Apps
Answered

Checking if a Person is already addet do a field in SharePoint

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a people column in SharePoint where I can add multiple people to a field. Now I want to check in PowerApps whether a person is already in this field. If not, the person is added to the field (already coded).

 

Thank you in advance.

Categories:
  • SkiDK Profile Picture
    1,016 on at

    Hey @Anonymous 

     

    You could just do a Filter search on the table to see if this person exists and see if the seqrch is empty. The IsEmpty() will return true if the Filter search has no results to return, meaning that this person does not exist in the table. The if function will then on 'true' execute the code to add the person to the table. If return false, meaning person does existm do nothing or add code to take other measures.

     

    If( IsEmpty( Filter( DATASOURCE_TABLE, person = vPersonToAdd)), ADD PERSON CODE ) )

    I hope this helps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Good idea, I think that's the right approach,

    but my next problem is that the person in the column and the User() are different argument types.

    IsEmpty(Filter(DATASOURCE_TABLE, columnName = User()))

    It gives me the error: "Invalid argument type"

    even if I write

    IsEmpty(Filter(DATASOURCE_TABLE, columnName.Email = User().Email))))

    it gives me the same error.

    I think that's because in columName there could be more than one person, therefore it's a different argument type. but idk.

  • SkiDK Profile Picture
    1,016 on at

    I'm not sure how your table is constructed. Do you have a column 'Name' in which records get stored for each added person? If so, you should do the next:

     

    IsEmpty(Filter(DATASOURCE_TABLE, personName = User().FullName))

    'DATASOURCE_TABLE' is the source you need to search in. 'personName' is the title of the column in which you can only store the name of the user, and not the object User. When you call User(), you'll call an object of the user that contains different variables. But if you want to search on the name of the user, you should get the proper variable from the object: thus you need to extract the FullName from the User. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    My column type is "Person or Group" and I have checked the "Allow multiple selection" box.
    I tried to write each person's name in a text column using flow. But it turned out to be a more difficult problem.

    I just want to check if a Person is already present in a multiselect Person Field.
    I have the feeling that the rest of Microsoft can't handle multiselect person columns. 

  • SkiDK Profile Picture
    1,016 on at

    Okay, so just to get clear. You have a table that contains a column "Person or Group". In every record there is a field for this column where you can add one or more persons, right?

     

    So now you have a name of a person, and you want to check if it already exists in that field of a certain record?

     

    You also want to be able to display all of the names of that field of a certain record?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @SkiDK wrote:

    Okay, so just to get clear. You have a table that contains a column "Person or Group". In every record there is a field for this column where you can add one or more persons, right?

    Exactly, or leave it empty

     


    So now you have a name of a person, and you want to check if it already exists in that field of a certain record?


    Basically the user who uses my app has to add himself by pressing a button, but first i have to check if he is already in that field so he doesnt add himself twice. SharePoint itself doesnt let that happen but i have other code which needs that. I thought this would be the easiest way but i've been trying to change my code for 3 hours now.

     

    You also want to be able to display all of the names of that field of a certain record?


    Yes

     

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    In reference to this other thread posted by you:
     
    If you do not want current user to be added again, you can modify your expression as:
     
    ClearCollect(ExistingUsers,If(!(User().Email in LookUp(UserList,Title = "test").PersonField.Email),Table({'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Claims:"i:0#.f|membership|" & User().Email,
        Department:"",
       DisplayName:User().FullName,
             Email:User().Email,
          JobTitle:"",
           Picture:""
       })),LookUp(SPList,Title = "test").PersonField);
    Patch(SPListName,LookUp(SPListName,Title = "test"),{PersonField:ExistingUsers})
     
    This expression could be modified if you donot want to use the current user in this case, you just need to update the If condition.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous how are you progressing with this?

     

    @Anonymous 

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    no solution above worked out for me. So now i changed my multiselect-person-column to another Sharepoint list where i save the person with the ID of the field as the title. This works perfect for me even if its not a clean solution.

    Best regards.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard