microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Cannot add SingleValueExtendedProperties with New-MgUserContactFolderChildFolderContact

Open
#2,784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Needs Investigation
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Describe the bug

According to the description here:
https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.personalcontacts/new-mgusercontactfolderchildfoldercontact?view=graph-powershell-1.0

it should be possible to add a single value extended property with a complex object. However, this does not seem the case - the property is ignored and not created. Notes on behavior:

  • I am using an application + client secret to connect to an application that has the required privileges. Only this particular attribute seems to be failing, everything else is OK
  • Tested in with a root folder contact (New-MgUserContact) - same behavior
  • Tried with Invoke-MgGraph by executing a POST method - same behavior
  • Tried the workaround shown here - got an error.

Am I missing something regarding the ways on how to create, update and get these values?

Expected behavior

The expectation is that the single value extended property is created with the new contact.

How to reproduce
  1. Connect-MgGraph to the application with a clientID/Secret combo
  2. Create a complex parameter with a single value extended property as described here.
  3. Run New-MgUserContactFolderChildFolderContact and supply previously created object with the -BodyParameter option
SDK Version

Tested with 2.19.0 and 2.15.0

Latest version known to work for scenario above?

N/A

Known Workarounds

N/A

Debug output
Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - New-MgUserContactFolderChildFolderContact begin processing with parameterSet 'Create'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DEBUG: [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientSecret', ContextScope: 'Process', AppName: 'Import [REDACTED] staff contacts'.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DEBUG: [Authentication]: - Scopes: [User.ReadBasic.All, Contacts.ReadWrite].

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y

Confirm
Are you sure you want to perform this action?
Performing the operation "New-MgUserContactFolderChildFolderContact_Create" on target "Call remote 'POST /users/{user-id}/contactFolders/{contactFolder-id}/childFolders/{contactFolder-id1}/contacts' 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:
https://graph.microsoft.com/v1.0/users/[REDACTED]/contactFolders/AQMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQAuAAAD7G1PYAkti0KJuyx7OS5wDAEAkT47de3oXkqMvCDkwgVSKgAAAgEPAAAA/childFolders/AQMkAGY1YWI5ZGY3LTMwZTc
tNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQAuAAAD7G1PYAkti0KJuyx7OS5wDAEAgV8M0idVTEOcZXshFRtDQAADS080fgAAAA==/contacts

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19045; mk-MK),PowerShell/5.1.19041.4412
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.19.0
client-request-id : d11852a4-d9be-4c67-8e66-d2ede2a6f102

Body:
{
"emailAddresses": [
{
"address": "test.testinson@testco.com",
"name": "Test Testinson"
}
],
"givenName": "Test",
"initials": "TT",
"jobTitle": "Senior Tester",
"mobilePhone": "+1 555 5555",
"surname": "Testinson",
"singleValueExtendedProperties": [
{
"id": "String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Test",
"value": "Test"
}
],
"businessAddress": {
"city": "Los Angeles",
"countryOrRegion": "USA",
"street": "Test street"
}
}

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Created

Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : ccb5e721-364c-4128-ac11-284afad89124
client-request-id : d11852a4-d9be-4c67-8e66-d2ede2a6f102
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Switzerland North","Slice":"E","Ring":"3","ScaleUnit":"000","RoleInstance":"ZR1PEPF00000665"}}
Cache-Control : private
Date : Mon, 10 Jun 2024 17:20:35 GMT
Location :
https://graph.microsoft.com/v1.0/users('[REDACTED]')/contacts('AAMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQBGAAAAAADsbU9gCS2LQom7LHs5LnAMBwCBXwzSJ1VMQ5xleyEVG0NAAANLTzR_AACBXwzSJ1VMQ5xleyEVG0NAAANLUEV0AAA=')

Body:
{
"@odata.context":
"https://graph.microsoft.com/v1.0/$metadata#users('[REDACTED]')/contactFolders('AQMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQAuAAAD7G1PYAkti0KJuyx7OS5wDAEAkT47de3oXkqMvCDkwgVSKgAAAgEPAAAA')/childFolders('AQM
kAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQAuAAAD7G1PYAkti0KJuyx7OS5wDAEAgV8M0idVTEOcZXshFRtDQAADS080fgAAAA%3D%3D')/contacts/$entity",
"@odata.etag": "W/"EQAAABYAAACBXwzSJ1VMQ5xleyEVG0NAAANIfiZT"",
"id": "AAMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQBGAAAAAADsbU9gCS2LQom7LHs5LnAMBwCBXwzSJ1VMQ5xleyEVG0NAAANLTzR_AACBXwzSJ1VMQ5xleyEVG0NAAANLUEV0AAA=",
"createdDateTime": "2024-06-10T17:20:35Z",
"lastModifiedDateTime": "2024-06-10T17:20:35Z",
"changeKey": "EQAAABYAAACBXwzSJ1VMQ5xleyEVG0NAAANIfiZT",
"categories": [],
"parentFolderId": "AQMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQAuAAAD7G1PYAkti0KJuyx7OS5wDAEAgV8M0idVTEOcZXshFRtDQAADS080fgAAAA==",
"birthday": null,
"fileAs": "",
"displayName": "Test Testinson",
"givenName": "Test",
"initials": "TT",
"middleName": null,
"nickName": null,
"surname": "Testinson",
"title": null,
"yomiGivenName": null,
"yomiSurname": null,
"yomiCompanyName": null,
"generation": null,
"imAddresses": [],
"jobTitle": "Senior Tester",
"companyName": null,
"department": null,
"officeLocation": null,
"profession": null,
"businessHomePage": null,
"assistantName": null,
"manager": null,
"homePhones": [],
"mobilePhone": "+1 555 5555",
"businessPhones": [],
"spouseName": null,
"personalNotes": "",
"children": [],
"emailAddresses": [
{
"name": "Test Testinson",
"address": "test.testinson@testco.com"
}
],
"homeAddress": {},
"businessAddress": {
"street": "Test street",
"city": "Los Angeles",
"countryOrRegion": "USA"
},
"otherAddress": {}
}

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y

DEBUG: [CmdletEndProcessing]: - New-MgUserContactFolderChildFolderContact end processing.

Confirm
Continue with this operation?
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): Y
DisplayName Id EmailAddresses


Test Testinson AAMkAGY1YWI5ZGY3LTMwZTctNDY0NS04ZWFmLTQ5ZTcyMzc1YzIxOQBGAAAAAADsbU9gCS2LQom7LHs5LnAMBwCBXwzSJ1VMQ5xleyEVG0NAAANLTzR_AACBXwzSJ1VMQ5xleyEVG0NAAANLUEV0AAA= {Test Testinson}

</details>


### Configuration

Name                           Value
----                           -----
PSVersion                      5.1.19041.4412
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4412
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

### Other information

Also tried this:
https://learn.microsoft.com/en-us/graph/api/singlevaluelegacyextendedproperty-get?view=graph-rest-1.0&tabs=http

It seems to indicate that you need to use the expandProperty option to get the attribute - however, I keep getting errors. If I use
`-ExpandProperty "SingleValueExtendedProperties(`$filter=id eq 'Test')":`

Get-MgUserContactFolderChildFolderContact : PropertyId values may only be in one of the following formats: 'MapiPropertyType namespaceGuid Name propertyName', 'MapiPropertyType namespaceGuid Id propertyId' or 'MapiPropertyType propertyT
ag'.
Status: 400 (BadRequest)
ErrorCode: ErrorInvalidProperty

if I use:
`-ExpandProperty "SingleValueExtendedProperties(`$filter=id eq Test)"`
Get-MgUserContactFolderChildFolderContact : Parsing OData Select and Expand failed: Could not find a property named 'Test' on type 'microsoft.graph.singleValueLegacyExtendedProperty'.
Status: 400 (BadRequest)
ErrorCode: BadRequest

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with New-MgUserContactFolderChildFolderContact, New-MgUserContact, and Invoke-MgGraph using the documented singleValueExtendedProperties payload. Compare the request and response with the Microsoft Graph single-value legacy extended property documentation and issue 1743. Done means the property is created and can be retrieved without the reported expand or property-format errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.