Problem with New-MgSiteListItem's -Fields property (JSON body is being serialized into camelCase)

Jeremy Bradshaw 31 Reputation points
2022-05-25T18:44:04.133+00:00

Hello, this question stems from this open issue - https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/1185. Essentially, when we do:

$fields = @{
    Color = 'Blue'
    Size   = 'Large'
}
New-MgSiteListItem -SiteId "{the site ID}" -ListId "{the list ID}" -Fields $fields

We get: "message": "Field 'color' is not recognized". The 'color' (actually 'Color') field is the alphabetically first field. If we had also included another field that started with 'A' or 'B' for the first letter, the error message would have mentioned that field, and would show its first letter in lowercase.

We can work around this problem by using Invoke-MgGraphRequest or MSGraphPSEssentials' New-MSGraphRequest, so the issue seems to be isolated to the New-MgSiteListItem cmdlet.

I guess the question is just - can you please fix this:)?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,206 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,512 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,116 Reputation points
    2022-05-26T08:07:25.257+00:00

    Hi @Anonymous ,

    Thanks for letting us know your user experience. When I received the case, I searched a lot of documents did a lot of researches. And I feel regretful to inform you that it is most probably a bug.

    We suggest you open a user voice in the following forum. With issue like this increase, the problem may well be fixed in the future. Thanks for your understanding.

    Forum:
    https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform/label-name/Microsoft%20Graph


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.