cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JanLektonen
Level: Powered On

Patch with SPListExpandedUser in Sharepoint list stopped working

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
Power Apps Staff AllenKim
Power Apps Staff

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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")
 }
)

View solution in original post

9 REPLIES 9
Super User
Super User

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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")}
)






--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
JanLektonen
Level: Powered On

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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"?

Super User
Super User

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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")
} )

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
JanLektonen
Level: Powered On

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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" }
  }
)

 

 

JanLektonen
Level: Powered On

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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...

Super User
Super User

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
Power Apps Staff AllenKim
Power Apps Staff

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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.

Power Apps Staff AllenKim
Power Apps Staff

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

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")
 }
)

View solution in original post

Anonymous
Not applicable

Re: Patch with SPListExpandedUser in Sharepoint list stopped working

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,152)