Make a rest csom call - error in body
-
20-02-2021 - |
質問
I'm using a flow http request and wish to update a sharepoint column with the following uri:
_vti_bin/client.svc/ProcessQuery
It all works , but when i try to add html tags, <a href="https://google.com">Google</a>
within parameter tags
I get an error:
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="Javascript Library">
<Actions>
<Method Name="SetFieldValue" Id="4" ObjectPathId="3">
<Parameters>
<Parameter Type="String">wfRef</Parameter>
<Parameter Type="String"><a href="https://google.com">Google</a></Parameter>
</Parameters>
</Method>
<Method Name="SystemUpdate" Id="5" ObjectPathId="3" />
</Actions>
<ObjectPaths>
<Property Id="1" ParentId="0" Name="Web" />
<Method Id="2" ParentId="1" Name="GetList">
<Parameters>
<Parameter Type="String">/sites/mySite</Parameter>
</Parameters>
</Method>
<Method Id="3" ParentId="2" Name="GetItemById">
<Parameters>
<Parameter Type="Number">12</Parameter>
</Parameters>
</Method>
<StaticProperty Id="0" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />
</ObjectPaths>
</Request>
Error message:
"ErrorInfo": {
"ErrorMessage": "The element 'Parameter' in namespace 'http://schemas.microsoft.com/sharepoint/clientquery/2009' has invalid child element 'a' in namespace 'http://schemas.microsoft.com/sharepoint/clientquery/2009'. List of possible elements expected: 'Property, Object, Include' in namespace 'http://schemas.microsoft.com/sharepoint/clientquery/2009'.",
"ErrorValue": null,
I've tried escaping the forward slashes with a backslash but get same error.
Any ideas anyone?
解決
Well, the message is clear that you have an A element within your Parameter XML. Your A element must be escaped, or else it will be rendered as a normal XML. It's not the slashes you need to escape, it's the whole A element itself within that you need to escape.
Use this tool: https://www.freeformatter.com/xml-escape.html. You'll get this:
<a href="https://google.com">Google</a>
所属していません sharepoint.stackexchange