I am testing a proof concept to use GRAPH API with a SharePoint Online (SP) site created via MS Teams. I have a simple list on the Site, which I have populated 2 records directly in SP for testing purposes and I am looking to test simple CRUD actions, using POSTMAN. The longer term goal is to use an automation program (BPA Platform) to use it Web Service tool to retrieve this data for storage in an onsite SQL db for other business systems to use. It is likely the SP List will have a low code solution over the top as a user interface (probably PowerApps) and therefore all the help needs to just use HTTPS calls and not another code solution, thank you.
The authentication root I have used so far is Azure App to create a App secret and assign that app correct permission
The SP List has the following definition of columns
I am able to retrieve the items of the list with the call
https://graph.microsoft.com/v1.0/sites/{{IT_Testing_Id}}/lists/{{ListID}}/items?expand=fields
The return is (I have only shown the fields)
"fields": {
"@odata.etag": "\"1512bad7-b01f-494d-924c-88c44104cae2,1\"",
"Title": "Apple",
"LinkTitleNoMenu": "Apple",
"LinkTitle": "Apple",
"Ref": "1",
"Number": 2.0,
"DateTest": "2023-10-30T00:00:00Z",
"PartNo": "1010910.A",
"LookupLookupId": "1",
"id": "1",
"ContentType": "Item",
"Modified": "2023-11-02T08:50:53Z",
"Created": "2023-11-02T08:50:53Z",
"AuthorLookupId": "9",
"EditorLookupId": "9",
"_UIVersionString": "1.0",
"Attachments": false,
"Edit": "",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": ""
}
},
"fields": {
"@odata.etag": "\"4c1a4755-1e58-4bac-b04f-f3270d8aed03,1\"",
"Title": "Orange",
"LinkTitleNoMenu": "Orange",
"LinkTitle": "Orange",
"Ref": "2",
"Number": 5.0,
"DateTest": "2023-11-02T00:00:00Z",
"PartNo": "1020020",
"LookupLookupId": "2",
"id": "2",
"ContentType": "Item",
"Modified": "2023-11-02T08:56:09Z",
"Created": "2023-11-02T08:56:09Z",
"AuthorLookupId": "9",
"EditorLookupId": "9",
"_UIVersionString": "1.0",
"Attachments": false,
"Edit": "",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": ""
}
},
However, the issue is on the POST, when I complete the POST I get a status of 201 Created
However in SP I see this:
I believe I am not sending the correct information in my Post command.
here are the details of the post
Post command call https://graph.microsoft.com/v1.0/sites/{{IT_Testing_Id}}/lists/{{ListID}}/items
Header details
{
"Title": "Pear",
"Ref": "25",
"Number": 2.0,
"DateTest": "2023-10-30T00:00:00Z",
"PartNo": "5000000.A"
}
The response is
"fields": {
"@odata.etag": "\"038843b1-b587-441b-aa90-a8cef5e53c28,1\"",
"Number": 0.0,
"DateTest": "2023-11-03T11:43:58Z",
"id": "15",
"ContentType": "Item",
"Modified": "2023-11-03T11:43:58Z",
"Created": "2023-11-03T11:43:58Z",
"AuthorLookupId": "1073741822",
"EditorLookupId": "1073741822",
"_UIVersionString": "1.0",
"Attachments": false,
"Edit": "",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": "",
"AppAuthorLookupId": "10",
"AppEditorLookupId": "10"
}
notice the id has moved on but the data is empty
Can anyone suggest any things to try please? I am guessing that I am not supplying the correct header information / format?
my main references have been Getting Started with Graph API and Graph Explorer Overview of Microsoft Graph
The fields names must be inside the fields
property when sending POST request.
{
"fields": {
"Title": "Pear",
"Ref": "25",
"Number": 2.0,
"DateTest": "2023-10-30T00:00:00Z",
"PartNo": "5000000.A"
}
}