cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alicja
Frequent Visitor

Problem with data format when trying to upadate item on Sharepoint list

Hello, 
I am trying send an http request to Sharepoint calendar to update event by using flow like this:

image.pngimage.png


This is a body:

 

{
"formValues": 
[

{"FieldName": "EventDate", "FieldValue": "5/10/2020 0:00 AM"},
{"FieldName": "EndDate", "FieldValue": "5/10/2020 0:00 AM"},
{"FieldName": "fAllDayEvent", "FieldValue":  "True"}
],
"bNewDocumentUpdate": true
}

 

This is a response:

 

{
  "d": {
    "ValidateUpdateListItem": {
      "__metadata": {
        "type": "Collection(SP.ListItemFormUpdateValue)"
      },
      "results": [
        {
          "ErrorMessage": "Enter a date and time like this: 2/23/2012 2:25 PM",
          "FieldName": "EventDate",
          "FieldValue": "5/10/2020 0:00 AM",
          "HasException": true,
          "ItemId": 34
        },
        {
          "ErrorMessage": "Enter a date and time like this: 2/23/2012 2:25 PM",
          "FieldName": "EndDate",
          "FieldValue": "5/10/2020 0:00 AM",
          "HasException": true,
          "ItemId": 34
        },
        {
          "ErrorMessage": null,
          "FieldName": "fAllDayEvent",
          "FieldValue": "True",
          "HasException": false,
          "ItemId": 34
        }
      ]
    }
  }
}

 

 

I was formatted datetime by using the formula:

formatDateTime( if(empty(triggerBody()?['XXX']),triggerBody()?['YYY'],triggerBody()?['ZZZ']),'M/d/yyyy H:mm tt')
Also I was trying insert there for example: 'M/d/yyyy H:m tt', 'MM/dd/yyyy HH:mm tt', but nothing is work, always the same exception. Does somebody have any ideas what can also I try ? 

2 ACCEPTED SOLUTIONS

Accepted Solutions

 

Hi @Alicja ,

 

If you want to create/update the event as an all-day event, EndDate needs to be yyyy-MM-ddT23:59:00.

Please check the following links:

https://powerusers.microsoft.com/t5/I-Found-A-Bug/All-Day-Event-in-a-SharePoint-Calendar-is-not-reco...

https://github.com/SharePoint/sp-dev-docs/issues/2755

 

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

I am using now formulas like below and it works for me:

{
"formValues": 
[

{"FieldName": "EventDate", "FieldValue": "@{formatDateTime(variables('StartDate'), 'yyyy-MM-dd 12:00:00')}"},
{"FieldName": "EndDate", "FieldValue": "@{formatDateTime(variables('EndDate'), 'yyyy-MM-dd 23:59:00')}"},
{"FieldName": "fAllDayEvent", "FieldValue":  "True"}
],
"bNewDocumentUpdate": true
}

 

Thank you for your help 😉

View solution in original post

4 REPLIES 4
v-bacao-msft
Community Support
Community Support

 

Hi @Alicja ,

 

Please try this format: yyyy-MM-ddTHH:mm:ssZ 

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

It is not working for me. 

Input body:

{
"formValues": 
[

{"FieldName": "EventDate", "FieldValue": "2020-05-20T00:00:00Z"},
{"FieldName": "EndDate", "FieldValue": "2020-05-20T00:00:00Z"},
{"FieldName": "fAllDayEvent", "FieldValue":  "True"}
],
"bNewDocumentUpdate": true
}

Output body:

 

{
  "d": {
    "ValidateUpdateListItem": {
      "__metadata": {
        "type": "Collection(SP.ListItemFormUpdateValue)"
      },
      "results": [
        {
          "ErrorMessage": "You must specify a valid date within the range of 1/1/1900 and 12/31/8900.",
          "FieldName": "EventDate",
          "FieldValue": "2020-05-20T00:00:00Z",
          "HasException": true,
          "ItemId": 43
        },
        {
          "ErrorMessage": "You must specify a valid date within the range of 1/1/1900 and 12/31/8900.",
          "FieldName": "EndDate",
          "FieldValue": "2020-05-20T00:00:00Z",
          "HasException": true,
          "ItemId": 43
        },
        {
          "ErrorMessage": null,
          "FieldName": "fAllDayEvent",
          "FieldValue": "True",
          "HasException": false,
          "ItemId": 43
        }
      ]
    }
  }
}

 

 

Hi @Alicja ,

 

If you want to create/update the event as an all-day event, EndDate needs to be yyyy-MM-ddT23:59:00.

Please check the following links:

https://powerusers.microsoft.com/t5/I-Found-A-Bug/All-Day-Event-in-a-SharePoint-Calendar-is-not-reco...

https://github.com/SharePoint/sp-dev-docs/issues/2755

 

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I am using now formulas like below and it works for me:

{
"formValues": 
[

{"FieldName": "EventDate", "FieldValue": "@{formatDateTime(variables('StartDate'), 'yyyy-MM-dd 12:00:00')}"},
{"FieldName": "EndDate", "FieldValue": "@{formatDateTime(variables('EndDate'), 'yyyy-MM-dd 23:59:00')}"},
{"FieldName": "fAllDayEvent", "FieldValue":  "True"}
],
"bNewDocumentUpdate": true
}

 

Thank you for your help 😉

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,066)