You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to create a new list item using the new-mgsitelistitem method, I get an error status: 500 (Internal Server Error) if any of my fields within the body parameter are a number. This applies whether the number is a string or not. If I add an alpha or symbol character, it works fine.
Expected behavior
I expected to have a new item in my list with my employee number field to be stored in the Employee Number column.
How to reproduce
Here is the script I use to connect to Graph and submit a new item to my Sharepoint list.
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgSiteListItem_Create" on target "Call remote 'POST /sites/{site-id}/lists/{list-id}/items' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/2025.0.0
SdkVersion : graph-powershell/2.26.1
client-request-id : ae3ee7af-23d1-4be2-8020-9255eb681e35
Accept-Encoding : gzip,deflate,br
Body:
{
"fields": {
"EmpIdentifier": 12345,
"Title": "Disabled Account",
"NewPosition": "Master of All",
"NewLocation": "New Location",
"Position": "Net Admin2",
"LastName": "Test Last Name",
"Location": "Old Location",
"FirstName": "First Last Name"
}
}
</details>
### Configuration
- OS: Windows 11 PRO 24H2
-
- Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
I've only tried it on this one machine.
### Other information
_No response_
The text was updated successfully, but these errors were encountered:
Hi @belchershane apologies for the inconvenience. This is an automatic inferencing issue and was already reported here #3187 and the correction will be available in the next release. I'll therefore close this as a duplicate.
Describe the bug
When trying to create a new list item using the new-mgsitelistitem method, I get an error status: 500 (Internal Server Error) if any of my fields within the body parameter are a number. This applies whether the number is a string or not. If I add an alpha or symbol character, it works fine.
Expected behavior
I expected to have a new item in my list with my employee number field to be stored in the Employee Number column.
How to reproduce
Here is the script I use to connect to Graph and submit a new item to my Sharepoint list.
$siteId = (get-MgSite -Search 'Automated Processes').Id
#$List = Get-MgSiteList -SiteId $siteId -Filter 'displayName eq 'Daily Account Updates''
$list = Get-MgSiteList -ListId '' -SiteId $siteId #removed for confidentiality.
$NewItemParameters = @{
fields = @{
Title = 'Disabled Account'
FirstName = 'First Last Name'
LastName = 'Test Last Name'
Location = 'Old Location'
NewLocation = 'New Location'
Position = 'Net Admin2'
NewPosition = 'Master of All'
EmpIdentifier = '12345'
}
}
#$Fields = Get-MgSiteList -SiteId $siteId -ListId $List.Id -ExpandProperty Columns | Select-Object -ExpandProperty Columns | Select-Object DisplayName, Name
$NewItem = New-MgSiteListItem -SiteId $siteId -ListId $List.Id -BodyParameter $NewItemParameters
SDK Version
2.26.1
Latest version known to work for scenario above?
No response
Known Workarounds
Make the Employee Number field a alpha field by adding a symbol or a letter to the input.
Debug output
Click to expand log
```Welcome to Microsoft Graph!
Connected via userprovidedaccesstoken access using
Readme: https://aka.ms/graph/sdk/powershell
SDK Docs: https://aka.ms/graph/sdk/powershell/docs
API Docs: https://aka.ms/graph/docs
NOTE: You can use the -NoWelcome parameter to suppress this message.
DEBUG: [CmdletBeginProcessing]: - New-MgSiteListItem begin processing with parameterSet 'Create'.
DEBUG: [Authentication]: - AuthType: 'UserProvidedAccessToken', TokenCredentialType: 'UserProvidedAccessToken', ContextScope: 'Process', AppName: ''.
DEBUG: [Authentication]: - Scopes: [Sites.FullControl.All].
Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgSiteListItem_Create" on target "Call remote 'POST /sites/{site-id}/lists/{list-id}/items' operation".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): y
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/2025.0.0
SdkVersion : graph-powershell/2.26.1
client-request-id : ae3ee7af-23d1-4be2-8020-9255eb681e35
Accept-Encoding : gzip,deflate,br
Body:
{
"fields": {
"EmpIdentifier": 12345,
"Title": "Disabled Account",
"NewPosition": "Master of All",
"NewLocation": "New Location",
"Position": "Net Admin2",
"LastName": "Test Last Name",
"Location": "Old Location",
"FirstName": "First Last Name"
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : bf35033f-810c-4882-9b58-9628606d4225
client-request-id : ae3ee7af-23d1-4be2-8020-9255eb681e35
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"BL02EPF000365D8"}}
Date : Tue, 18 Mar 2025 17:25:33 GMT
Body:
{
"error": {
"code": "generalException",
"message": "General exception while processing",
"innerError": {
"date": "2025-03-18T17:25:34",
"request-id": "bf35033f-810c-4882-9b58-9628606d4225",
"client-request-id": "ae3ee7af-23d1-4be2-8020-9255eb681e35"
}
}
}
New-MgSiteListItem_Create: C:\Users\belcher.shane\OneDrive - secep.net\Documents\PowerShell\SP\Sharepoint Connect-Graph.ps1:45:1
Line |
45 | $NewItem = New-MgSiteListItem -SiteId $siteId -ListId $List.Id -BodyP …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| General exception while processing Status: 500 (InternalServerError) ErrorCode: generalException Date: 2025-03-18T17:25:34 Headers: Cache-Control : no-store, no-cache Vary
| : Accept-Encoding Strict-Transport-Security : max-age=31536000 request-id : bf35033f-810c-4882-9b58-9628606d4225 client-request-id :
| ae3ee7af-23d1-4be2-8020-9255eb681e35 x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"East US","Slice":"E","Ring":"5","ScaleUnit":"002","RoleInstance":"BL02EPF000365D8"}} Date
| : Tue, 18 Mar 2025 17:25:33 GMT
Recommendation: See service error codes: https://learn.microsoft.com/graph/errors
DEBUG: [CmdletEndProcessing]: - New-MgSiteListItem end processing.
The text was updated successfully, but these errors were encountered: