cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yjamous
Helper II
Helper II

Updating SharePoint List item with Email

Hi

I'm trying to create new items in SharePoint List.

One of the columns in the SharePoint list is Contact Person. This field type in SharePoint is "Person or Group".

I'm trying to update the list using the following code:

 

Patch('Register',Defaults('Register'),
{'Communication Purpose': CommPurposeTxt.Text},
{'Communication Date':CommDate.SelectedDate},
{'Contact':ApplicantEmailLbl.Text},
)

ApplicantEmailLbl is a label with the value User().Email

 

The error message is attachedError MessageError Message

 
 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@yjamous 

You cannot patch a Person column by just supplying the email address, you need to provide a full person record to it.

 

Consider this to replace your Formula:

 

Patch('Register', Defaults('Register'),
    {'Communication Purpose': CommPurposeTxt.Text,
     'Communication Date':CommDate.SelectedDate,
     'Contact':
         { 
         '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
          Claims:"i:0#.f|membership|" & Lower(ApplicantEmailLbl.Text), 
          Department:"", 
          DisplayName:ApplicantEmailLbl.Text, 
          Email:ApplicantEmailLbl.Text, 
          JobTitle:".", 
          Picture:"."
          }
    }
)

 

 

Also note (to save you time) you do not need to put { } around each column of your record, just to start and end as above.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

3 REPLIES 3
RandyHayes
Super User III
Super User III

@yjamous 

You cannot patch a Person column by just supplying the email address, you need to provide a full person record to it.

 

Consider this to replace your Formula:

 

Patch('Register', Defaults('Register'),
    {'Communication Purpose': CommPurposeTxt.Text,
     'Communication Date':CommDate.SelectedDate,
     'Contact':
         { 
         '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
          Claims:"i:0#.f|membership|" & Lower(ApplicantEmailLbl.Text), 
          Department:"", 
          DisplayName:ApplicantEmailLbl.Text, 
          Email:ApplicantEmailLbl.Text, 
          JobTitle:".", 
          Picture:"."
          }
    }
)

 

 

Also note (to save you time) you do not need to put { } around each column of your record, just to start and end as above.

 

I hope this is helpful for you.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Thanks @RandyHayes 

That was spot on. I just have one question: 

Would any of these values be updated in Active Directory?

 

          Department:"", 
          DisplayName:ApplicantEmailLbl.Text, 
          Email:ApplicantEmailLbl.Text, 
          JobTitle:".", 
          Picture:"."
          }

 

@yjamous 

No, the user object in SharePoint is not Active Directory.  SharePoint has always had its own user and group information, and the records for that are stored in that format in SharePoint.

SharePoint, however will derive that "empty" values it needs from ActiveDirectory (if the user is "new" to SharePoint) and from their User object in SharePoint (if they have already access SharePoint before).

In order to "trigger" SharePoint to "fill in the blanks", you have to supply at least the Claims, DisplayName and Email with values and the rest can be "dummy" values.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (76,385)