Due to lack of a built-in Modern Calendar interface and our corporation's restrictions on what we can do within the sites in our tenant, I'm trying to build a Flow in Power Automate that copies calendar entries from an Events List in one site collection to an Events List in a different site collection.

At first I tried to use the item information provided in the triggerBody() of the created/modified trigger to create the new calendar entries, but there are hidden columns that aren't available through that interface (either to get or set in the newly created item). So I had to move on to Send an HTTP request to SharePoint step to get all the columns I need. This seems to be working and I get some a JSON response that looks like this:

  "d": {
    "ID": 37,
    "Title": "Simple single event",
    "Modified": "2020-01-23T23:24:10Z",
    "Created": "2020-01-23T23:24:10Z",
    "EventDate": "2020-01-25T00:00:00Z",
    "EndDate": "2020-01-25T01:00:00Z",
    "Description": "<p>Description goes here!​</p>",
    "fAllDayEvent": false,
    "fRecurrence": false,
    "EventType": 0,
    "UID": null,
    "RecurrenceID": null,
    "Duration": 3600,
    "RecurrenceData": null,
    "MasterSeriesItemID": null

I follow up the request step with a Parse JSON step and I used this tutorial to modify the schema and to either convert the values to appropriate types or to accept no value or null. When I run a test, the output body for the parse looks right to me. I see what I have above and there are now dynamic variables for me to access. It looks right to me because things that are strings are in quotes, numbers and booleans have no quotes and are blue, same with null. It all appears to be a correct strongly typed version of the provided JSON.

My problem comes in trying to use that parsed JSON data with a REST POST to create a new item. Using the dynamic data names parsed by the previous steps the strings I manually construct a body like this:

enter image description here

I have to add quote marks for the ones I know will be strings, but for the booleans (fAllDayEvent or fRecurrence) I don't see that false gets changed to False. And for the ones that could be null I don't know what to do. I want to pass null and not "null". But at other times the null values might actually be strings and at that point they would need to have quotes. I just can't seem to coerce the parsed values back into acceptable JSON format.

I can't find anything to help with this because all searches point back to the Parse JSON action. And maybe that is the solution, but I'm not seeing how.

Any idea how to pass the parsed JSON value to a REST POST create item endpoint in correct JSON value format, when it might be null, string, or number depending?

1 Answer 1


I think you might be better off using the "Compose" action with the value set to body('Name_Of_Your_Http_Request_To_SharePoint_Action')?['d'] Then you can use another Compose step, in conjunction with removeProperty to remove the ID and addProperty to add the _metadata object. This way you would be guaranteed to pass all the values in the same format as you received, rather than trying to rebuild your JSON from scratch.

  • Thanks this is what I first thought would be the approach, but didn't know about Compose. Can you explain a bit more about how to use removeProperty? All I get is "The expression is invalid."
    – Rothrock
    Jan 27, 2020 at 16:18
  • Okay figured out that I need to use single quotes and not double quotes to get a valid statement. But now I get a message that the removeproperty expects the first argument to be of type object not type null. I'm using removeProperty(body('FirstCompose'),'__metadata')
    – Rothrock
    Jan 27, 2020 at 16:30
  • hmm, yeah, you can't manipulate the result of a previous action -- maybe the first one should just be the initialization of an object variable set to the ['d'] object from your SharePoint action. Then you can use expressions in a compose to remove the property. Although, I think __metadata is the one you need to add, not the one you need to remove. You can nest your expressions so you don't have to have a bunch of steps, for example, addProperty(removeProperty(body('FirstCompose'), 'ID'), '__metadata', json('{ "type": "SP.Data.SabaListItem" }'))
    – willman
    Jan 27, 2020 at 16:56
  • Yes, all strings you use in expressions need to be in single quotes. If you ever "sneak a peek" a the generated code, you will see it is because everything you enter gets encapsulated in a double-quote delimited string. Incidentally, if you need to put a "string with a string" like in my example of using the json() function above, you switch to double quotes.
    – willman
    Jan 27, 2020 at 16:59
  • Yeah I realized I didn't need to remove and then add metadata back in and used setProperty(). And I figured out that I needed to use outputs('Set_metadata') to then manipulate the output from that step.
    – Rothrock
    Jan 27, 2020 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.