Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-MgSiteListItem field format issue int/str with 2.26.1 #3187

Closed
ssoabx opened this issue Feb 26, 2025 · 2 comments · Fixed by #3190
Closed

New-MgSiteListItem field format issue int/str with 2.26.1 #3187

ssoabx opened this issue Feb 26, 2025 · 2 comments · Fixed by #3190
Assignees
Labels
Bug - P1 type:bug A broken experience

Comments

@ssoabx
Copy link

ssoabx commented Feb 26, 2025

Describe the bug

I'm trying to update a sharepoint list via New-MgSiteListItem -SiteId "<SiteId>" -ListId "<Name>" -Fields $Fields but I always get an error.

the $fields looks like this:

$Fields = @{
    BuildID          = "3599"
    BasicCommitID    = "9c3d0f36362dd25caa0da2ecab06a1859ce2"
    BasicTag         = "v2.31.0"
    MWSCommitID      = "a5c7998252f2366c8cbbb03ba46e9b"
    MWSTag           = "v2.21.0"
    CustomerCommitID = "c40241be9fd2f1cd2f2f2fc961c37f720c"
  }

The error I get:

New-MgSiteListItem : General exception while processing
Status: 500 (InternalServerError)
ErrorCode: generalException
Date: 2025-02-26T08:35:19
Headers:
Transfer-Encoding             : chunked
Vary                          : Accept-Encoding
Strict-Transport-Security     : max-age=31536000
request-id                    : 18a4ef5d-41e5-4d3f-9a23-9e4d23c57860
client-request-id             : 7d060165-74af-43d6-a95b-1abe7f32ad19
x-ms-ags-diagnostic           : {"ServerInfo":{"DataCenter":"<Redacted> North","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"ZR2PE141400C8"}}
Cache-Control                 : no-store, no-cache
Date                          : Wed, 26 Feb 2025 08:35:18 GMT
In Zeile:1 Zeichen:3
+   New-MgSiteListItem -SiteId "<redacted>" - ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: ({ SiteId = e4d6...GraphListItem }:<>f__AnonymousType5`4) [New-MgSiteListItem_CreateExpanded], Exception
    + FullyQualifiedErrorId : generalException,Microsoft.Graph.PowerShell.Cmdlets.NewMgSiteListItem_CreateExpanded

I can use the exact same data / command in 2.25.0 and it works.
Looking at debugging I noticed that it doesn't put"numbers/int" in between quotation marks so when I add text to that field it suddenly works...

Expected behavior

List entry getting created

How to reproduce

See above

SDK Version

2.26.1

Latest version known to work for scenario above?

2.25.0

Known Workarounds

  • Downgrade
  • Force string in field

Debug output NOK

Not working, BuildID not in quotations in POST body DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/sites/e4d62495-b517-4d14-9f40-c5ab9a44fb04/lists/Build/items

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; de-CH),PowerShell/5.1.26100.2161
SdkVersion : graph-powershell/2.26.1
client-request-id : 201dea67-fcfc-4c05-9918-7323403c8012

Body:
{
"fields": {
"MWSCommitID": "a5c7998e8hsda4ac366c8cbbb03ba46e9b",
"BasicTag": "v2.31.0",
"BasicCommitID": "9c3d0fddhadafd1dd25caa0da2ecab06a1859ce2",
"BuildID": 3599,
"CustomerCommitID": "c40241be9fafafaf616271560951c961c37f720c",
"MWSTag": "v2.21.0"
}
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
InternalServerError

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 9b861af6-c20d-4b28-a9dc-7cbcfd930ecc
client-request-id : 201dea67-fcfc-4c05-9918-7323403c8012
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"XXX North","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"ZR1PXXX0000665"}}
Cache-Control : no-store, no-cache
Date : Wed, 26 Feb 2025 08:25:14 GMT

Body:
{
"error": {
"code": "generalException",
"message": "General exception while processing",
"innerError": {
"date": "2025-02-26T08:25:14",
"request-id": "9b861af6-c20d-4b28-a9dc-7cbcfd930ecc",
"client-request-id": "201dea67-fcfc-4c05-9918-7323403c8012"
}
}
}

Debug output Working

Working. **Notice value for "BuildID" now contains text**, and is being sent in quotations DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://graph.microsoft.com/v1.0/sites/e4d62495-b517-asfaff40-c5ab9a44fb04/lists/Build/items

Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; de-CH),PowerShell/5.1.26100.2161
SdkVersion : graph-powershell/2.26.1
client-request-id : effde308-4b23-471e-9c3e-0b0723cede13

Body:
{
"fields": {
"MWSCommitID": "a5c7998e8ade5affsaf64ac366c8cbbb03ba46e9b",
"BasicTag": "v2.31.0",
"BasicCommitID": "9c3d0fddfdfddaf5caa0da2ecab06a1859ce2",
"BuildID": "yy3599",
"CustomerCommitID": "c40241beafsfsfcd616271560951c961c37f720c",
"MWSTag": "v2.21.0"
}
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Created

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : b3bc2286-3452-44b5-9d44-bdb246a27c20
client-request-id : effde308-4b23-471e-9c3e-0b0723cede13
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"XXXX North","Slice":"E","Ring":"3","ScaleUnit":"001","RoleInstance":"ZRH2EPXXX000E9"}}
OData-Version : 4.0
Cache-Control : no-cache
Date : Wed, 26 Feb 2025 08:48:39 GMT
ETag : "a2395d18-1e2b-4f46-92e4-0c4a75e6cdd4,1"
Location : XXX

[...]

Configuration

  • OS: Win11, Server2022
@timayabi2020
Copy link
Contributor

Hi @ssoabx sorry for this experience. There is already an existing PR under review to resolve this issue.

@ssoabx
Copy link
Author

ssoabx commented Feb 26, 2025

Thank you for the quick PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug - P1 type:bug A broken experience
Projects
None yet
2 participants