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 / Patch with SPListExpan...
Power Apps
Answered

Patch with SPListExpandedUser in Sharepoint list stopped working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi - this used to work in our production app, but suddenly it stopped working. 

 

I have issolated the problem to the Field "User"

 

I get this error when adding the "User" field-code":

-Invalid arguement type expecting record value but different schema type

 

Patch(CRMUserSettings; Defaults(CRMUserSettings); 
{ 
 User: {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"; 
 Claims:Lower(User().Email);
 Department:"."; 
DisplayName:User().Email; Email:User().Email; JobTitle:"."; Picture:"."}; Title:"User created by PowerApps | " & Text( Now(); "[$-da]dd/mm/yyyy hh:mm:ss")} )

 

I have followed all examples on how to do it but still it fails now. Any help would be appreceiated. 

Categories:
I have the same question (0)
  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Give this a try:

     

    Patch(CRMUserSettings; Defaults(CRMUserSettings); 
    { 
     User: {
    '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:Concatenate("i:0#.f|membership|",User().Email),
     DisplayName:User().FullName,
     Email:User().Email
     }, 
     Title:"User created by PowerApps | " & Text( Now(); "[$-da]dd/mm/yyyy hh:mm:ss")}
    )
    
    
    
    
    
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Jeff_Thorpe

     

    I have tried it but no luck. I get the exact same error: 

    Invalid arguement type expecting record value but different schema type

     

    I also get the error that:

     

    Column 'ODataType' of text missing

     

    As far as I know I have all the right fields and data in place. Anyone knows what this error means and what is wrong?

     

    UPDATE:

    I have added the Column "ODataType" but get an error. I guess I do not know what to put in the field "ODataType"?

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    I just tested the code in a new app and I got a record error. I was able to resolve it by adding the additional fields to the record. Here is the odata record that worked for me.

     

     

    Patch(CRMUserSettings, Defaults(CRMUserSettings), 
     { User: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims:Concatenate("i:0#.f|membership|",User().Email),
     DisplayName:User().FullName,
     Email:User().Email,
     Department:"",
     JobTitle:"",
     Picture:""
     }, 
     Title:"User created by PowerApps | " & Text( Now(),"[$-da]dd/mm/yyyy hh:mm:ss")
    } )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Jeff_Thorpe

     

    Thanks for your feedback,

    the code you give me is almost the same as I used. If I try to paste your code I still get the error:

     

    Column 'ODataType' of type text is missing

     

    I can see the the Person Or Group field has a datafield called: ODataType like this (see red text):

     

    Patch(CRMUserSettings, Defaults(CRMUserSettings), 
     { User: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
    ODataType: "", Claims:Concatenate("i:0#.f|membership|",User().Email), DisplayName:User().FullName, Email:User().Email, Department:"", JobTitle:"", Picture:"" }, Title:"User created by PowerApps | " & Text( Now(),"[$-da]dd/mm/yyyy hh:mm:ss")
    } )

     

    But I do not know what to put into this text-field ? If I let it be blank I'm still left with the other error:

     

    "Invalid arguement type expecting record value but different schema type" ? (Anyone knows what this means?)

     

    Actually the old code used to work against Sharepoint Person Or Group field and nothing has changed in the data.

     

    UPDATE:

    There is a dataField on the Person Or Group field in Sharepoint. You can find it with this command:

     

    User().User.OdataType

    But I do not know what to put into this field. I have tried this with no luck:

      

    Patch(CRMUserSettings; Defaults(CRMUserSettings);
     { 
     Title:"SinglePerson";
     User: { ODatatype: #Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser";
     Claims: "i:0#.f|membership|" & User().Email;
     Department: User().Email;
     DisplayName: "xxx";
     Email: User().Email;
     JobTitle:".";
     Picture:"."
     };
     Startup: { '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"; Id:1; Value:"None" }
     }
    )

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Jeff_Thorpe

     

    I've just found out the the code is working in "Sharepoint Online". We use "Sharepoint On-Premise" and it is On-premise that the code stopped working.

     

    Did you test it on a sharepoint tabel on-premise or online?

     

    I have no clue how come it stopped working in Sharepoint On-premise...

  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    I am using O365 SharePoint (Online), so all my testing is done with the online version.

  • AllenKim Profile Picture
    Microsoft Employee on at

    Hi @JanLektonenI just wanted to let you know that I am aware of this issue and have identified the root cause. I am currently looking for a solution.

     

    FYI, I saw that you had another post. I thought I'd post my response here as well in case others are following this post.

  • Verified answer
    AllenKim Profile Picture
    Microsoft Employee on at

    Hi @JanLektonen,

     

    If you use the value "Blank()" for the 'ODataType' property, it should unblock you. So your rule will look like the following:

     

    Patch(CRMUserSettings, Defaults(CRMUserSettings), 
     { User: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     ODataType: Blank(),
     Claims:Concatenate("i:0#.f|membership|",User().Email),
     DisplayName:User().FullName,
     Email:User().Email,
     Department:"",
     JobTitle:"",
     Picture:""
     }, 
     Title:"User created by PowerApps | " & Text( Now(),"[$-da]dd/mm/yyyy hh:mm:ss")
     }
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard