-
Notifications
You must be signed in to change notification settings - Fork 211
Description
Describe the bug
I am importing the data via csv and then post that data into an object which fails if the employeeid field is present. The employee ID is a numerical value, and the error message states that it cannot be converted to a string.
"message": "Cannot convert the literal '800067' to the expected type 'Edm.String'.",
Expected behavior
This same script was working properly in previous versions of the Graph module and would not error and the user would be created with the EmployeeID.
How to reproduce
$users = c:\File.csv
$PasswordProfile = @{
Password = 'Password'
ForceChangePasswordNextSignIn = $true
}
foreach ($user in $users) {
# Create a new user
$userproperties = @{
DisplayName = $user.DisplayName.Trim()
GivenName = $user.FirstName.Trim()
Surname = $user.LastName.Trim()
UserPrincipalName = $user.UserPrincipalName.Trim()
UsageLocation = $user.UsageLocation.Trim()
MailNickname = $user.MailNickname.Trim()
JobTitle = $user.JobTitle.Trim()
CompanyName = $user.CompanyName.Trim()
Department = $user.Department.Trim()
EmployeeType = $user.EmployeeType.Trim()
EmployeeId = $user.EmployeeId.Trim()
}
New-MgUser @userproperties -AccountEnabled:$true -PasswordProfile $passwordProfile
}``
SDK Version
2.26.1
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 86bd8090-05bc-4629-a577-7317ff01a862
client-request-id : 0edf0233-39a3-4e85-8647-75893df47fc3
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West US","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"SJ1PEPF00002B91"}}
x-ms-resource-unit : 1
Date : Tue, 29 Apr 2025 23:52:09 GMT
Body:
{
"error": {
"code": "Request_BadRequest",
"message": "Cannot convert the literal '800067' to the expected type 'Edm.String'.",
"innerError": {
"date": "2025-04-29T23:52:10",
"request-id": "86bd8090-05bc-4629-a577-7317ff01a862",
"client-request-id": "0edf0233-39a3-4e85-8647-75893df47fc3"
}
}
}
Configuration
Name Value
PSVersion 7.5.1
PSEdition Core
GitCommitId 7.5.1
OS Microsoft Windows 10.0.22631
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Other information
No response