microsoftgraph / microsoftgraph/msgraph-sdk-powershell

Restore-MgBetaDirectoryDeletedItem missing BodyParameter parameter

Open
#3,318 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug: Documentation Dependency: metadata-issue Dependency: OData Dependency: OpenApi type:bug
Dominant language
C#
Stars
898
Forks
230
Avg merge
2d 5h
Merged PRs (30d)
31

Description

Describe the bug

The Restore-MgBetaDirectoryDeletedItem cmdlet documents the use of the Bodyparameter parameter https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.beta.identity.directorymanagement/restore-mgbetadirectorydeleteditem?view=graph-powershell-beta to pass details of deleted object being restored with a different UPN. V2.27 of the cmdlet says that no such parameter can be found.

Expected behavior

$DeletedUserUPN = "Marc.c.Vigneau@office365itpros.com"
$NewUserPrincipalName = "Marc.B.Vigneau@office365itpros.com"
$DeletedObject = Get-MgDirectoryDeletedItemAsUser -Filter "displayName eq 'Marc Vigneau'"
$NewUPNDetails = @{}
$NewUPNDetails.Add("newUserPrincipalName",$NewUserPrincipalName)
$NewUPNDetails.Add("autoReconcileProxyConflict",$true)

$Status = Restore-MgBetaDirectoryDeletedItem -DirectoryObjectId $DeletedObject.Id -BodyParameter $NewUPNDetails
Restore-MgBetaDirectoryDeletedItem: A parameter cannot be found that matches parameter name 'BodyParameter'.

How to reproduce

See above.

SDK Version

V2.27

Latest version known to work for scenario above?

V2.25

Known Workarounds

Use Graph request

Debug output
No debug because cmdlet fails immediately ```
</details>


### Configuration

Windows

Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
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

### Other information

_No response_

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 at the Restore-MgBetaDirectoryDeletedItem cmdlet entry point and compare its generated metadata or implementation between SDK versions 2.25 and 2.27. Reproduce the supplied PowerShell example, then verify that the cmdlet accepts BodyParameter and restores a deleted object with the requested new UPN; the existing Graph request workaround provides a comparison path.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.