question

RamPrasadMeenavalli-0975 avatar image
0 Votes"
RamPrasadMeenavalli-0975 asked RamPrasadMeenavalli-0975 commented

How to create a SharePoint List Item with DateTime field

I have a SharePoint list with some Date fields. When I try to create a new list item using Graph Explorer, the value which we pass in Request and what we receive in the Response are different. And what is getting saved in SharePoint is different.

Is this the expected behavior? How should we save the Date field values for SharePoint list items?

105720-image.png


This is what actually gets saved in SharePoint list

105765-image.png


microsoft-graph-sites-lists
image.png (70.4 KiB)
image.png (20.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered RamPrasadMeenavalli-0975 commented

Hi @RamPrasadMeenavalli-0975,

Per my test, I got the same results when creating list item with Date field using Graph Explorer. In response, the value of the date field displayed incorrectly.

106468-image.png

However, when I get the newly created item, the value of the date field would display correctly.

106531-image.png

I opened a new issue in github: https://github.com/microsoftgraph/microsoft-graph-docs/issues/13168

Besides, in sharepoint list, the value of the datefield display well on my end.
106409-image.png


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


If the response is helpful, please click "Accept Answer" and upvote it.



image.png (37.1 KiB)
image.png (32.2 KiB)
image.png (5.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you @MichaelHan-MSFT
Have you checked the SharePoint list using SharePoint APIs?

I guess the date is getting stored wrongly in SharePoint as well. I have added my comments on the github issue

0 Votes 0 ·
RamPrasadMeenavalli-0975 avatar image
0 Votes"
RamPrasadMeenavalli-0975 answered RamPrasadMeenavalli-0975 commented

Thank you @MichaelHan-MSFT
Have you checked the SharePoint list using SharePoint APIs?

I guess the date is getting stored wrongly in SharePoint as well. I have added my comments on the github issue

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Yes, I checked the SharePoint list with rest api /_api/web/lists/getbytitle('ListName')/items(id)

The date stored correcly in SharePoint.

0 Votes 0 ·

Somehow that's not the behavior for me.

As I posted in the Question, you can see the difference in time. What is posted through Graph API and what is returned from SharePoint REST API are different.

0 Votes 0 ·