Different SharePoint fields have different requirements for patching.
For a Person field you have to send an object with Claims, Department, DisplayName, Email, Jobtitle and Picture fields, but only the Claims, displayname and email address seem to be required (you may want to experiment with which fields actually need a value, but all of them have to be present). Below is an example from one of my powerapps
AssignedTo: {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:Concatenate("i:0#.f|membership|",Assignee.UserPrincipalName),
Department:"",
DisplayName:Assignee.DisplayName,
Email:Assignee.Mail,
JobTitle:"",
Picture:""
}
For SharePoint choice fields, you have to send an object with a value property
mychoicefield: {Value: "some value" }
For lookup fields, you have to send an ID and value, where ID is the ID from the lookup list item and Value is the Title
MyLookupField: { ID:1,Value:"Some title"}
Patch doesn't throw an error when you send the wrong information. YOu can capture and output your patch by setting a variable or checking for errors. I typically do both
Set(PatchResults,Patch(datasource,defaults(datasource),{
Title: "Hello"
};
If(Not(IsEmpty(Errors(datasource))),Notify(First(Errors(datasource)).Message,NotificationType.Error))
The above check if the datasource to which you patched has any errors and if there are, creates a message at the top with a red background.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…