Skip to content

New-MgUserContactFolderContact Parametr "-Profession" automatically converts string number into integer in payload #3278

@bobbyzna

Description

@bobbyzna

Describe the bug

I am trying to create outlook contact with parametrs such as GivenName, Surname, Title, JobTitle, etc. When i try to pass argument -Proffesion number in quotation marks (-Proffesion "1") it create the json payload with proffesion as integer without quotation marks. Even when i try to explicitly mark it as string or convert it to string.

Expected behavior

Create contact with profession parametr with only numbers that are typed as string.

How to reproduce

New-MgUserContactFolderContact -Debug -UserId "[email protected]" -ContactFolderId $a -GivenName "GivenName" -Surname "Surname" -Generation "MBA" -Title "Ing." -JobTitle "JobTitle" -Profession "1"

SDK Version

2.26.1

Latest version known to work for scenario above?

No response

Known Workarounds

if i append string character other than number, it works. such as "+1" "a1"

Debug output

Click to expand log ``` Headers: FeatureFlag : 00000003 Cache-Control : no-store, no-cache User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; cs-CZ),PowerShell/2025.0.0 SdkVersion : graph-powershell/2.26.1 client-request-id : 61253eee-c2cb-4dfb-9547-d40a566e58fa Accept-Encoding : gzip,deflate,br

Body:
{
"generation": "MBA",
"givenName": "givenName",
"jobTitle": "jobTitle",
"profession": 1,
"surname": "Surname",
"title": "Ing."
}

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

Status Code:
BadRequest

Headers:
Cache-Control : private
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 22530144-5854-4bb2-ab46-8af9485eb5c7
client-request-id : 61253eee-c2cb-4dfb-9547-d40a566e58fa
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"FR3PEPF000002DC"}}
Date : Wed, 16 Apr 2025 15:39:01 GMT

Body:
{
"error": {
"code": "UnableToDeserializePostBody",
"message": "were unable to deserialize "
}
}

New-MgUserContactFolderContact_CreateExpanded:
Line |
3 | … New-MgUserContactFolderContact -Debug -UserId "email@xx …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| were unable to deserialize

Status: 400 (BadRequest)
ErrorCode: UnableToDeserializePostBody
Date:

Headers:
Cache-Control : private
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000

</details>


### Configuration

-OS: Windows 11 Pro
Architecture: x64

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions