Skip to content

New-MGSiteListItem is submitting blank params in some cases (SDK v2.27) #3317

Closed
@westleyMS

Description

@westleyMS

Describe the bug

I have a script that takes a mailbox from Exchange powershell, and puts some of the properties into a list item. This works in v 2.25 of the Graph SDK. If I upgrade to 2.26 or 2.27, it sometimes submits a blank set of arguments.

Here is the abbreviated script I am running-
$mbx = Get-Mailbox -Identity admin
$params = @{
fields = @{
Title = "testxTitle"
SessionID = "xaf032-0f-30"
Mailbox = $mbx.PrimarySmtpAddress
Email = $mbx.PrimarySmtpAddress
FullAccess = $mbx.FullAccess
Owners = $mbx.Owners
SendAs = $sendasfinal
ApprovedSenders = $mbx.ApprovedSenders
Prefix = $pfx
MBName = $mbx.Name
Alias = $mbx.Alias
Aging = $aging
AgingDate = $agingdatefinal
Status = $status
}
}

New-MGSiteListItem -SiteID {siteid} -ListID {Listid} -BodyParameter $params

Here is what is posted-

Accept-Encoding: gzip, deflate, br Content-Type: application/json Content-Length: 2

{}

The response is that it creates an empty item in the list.

Expected behavior

I expect any properties that have values (like the primarySmtpAddress) to show in the parameters, and especially the ones that are hardcoded strings.

How to reproduce

  1. Create a script that gets an object with properties to add to a list
  2. Create a list and add fields for those properties
  3. run the script using graph sdk 2.27
  4. note the item that was created in the list specified in the parameters

SDK Version

2.27

Latest version known to work for scenario above?

2.25

Known Workarounds

if all params are hardcoded strings, it works, but this doesn't work for the application at hand, we need them dynamic.

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions