Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update-MgSitePage doesn't cast a page as microsoft.graph.sitePage #2919

Open
joshtransient opened this issue Aug 22, 2024 · 0 comments
Open

Comments

@joshtransient
Copy link

Describe the bug

When I run Update-MgSitePage -BodyParameter @{ canvasLayout = @{ ... } to change the content in canvasLayout, the command tries to PATCH "/v1.0/sites/{site-id}/pages/{page-id}", which doesn't work.

Per the doc page, the command is supposed to PATCH "/v1.0/sites/{site-id}/pages/{page-id}/microsoft.graph.sitePage"

Expected behavior

This command should not return an HTTP 400 when providing the ID of a site page.

How to reproduce

$site = Get-MgSite -SiteId ...
$pages = Get-MgSitePage -SiteId $siteId -Filter ...
foreach($page in $pages) {
  Update-MgSitePage -SiteId $siteId -BaseSitePageId $page.Id -BodyParameter @{ canvasLayout = @{ ... }
}

SDK Version

No response

Latest version known to work for scenario above?

2.22.0

Known Workarounds

As a workaround, I simply add '/microsoft.graph.sitePage' to the value I plug into {page-id}, and that seems to resolve the issue.

Debug output

Click to expand log ``` API not found

Status: 400 (BadRequest)
ErrorCode: invalidRequest
Date: 2024-08-22T14:50:41

Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
(add'l headers removed for privacy)

</details>

### Configuration

- Windows 11 23H2 build 22631.4037
- x64 architecture
- PowerShell 7.4.5

### Other information

I assume the problem here is that the MgSitePage cmdlets aren't aware of the microsoft.graph.sitePage type, hence the lack of a `-SitePageId` argument instead of `-BaseSitePageId`.
@joshtransient joshtransient added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Aug 22, 2024
@timayabi2020 timayabi2020 added Status: Needs Investigation and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants