-
Notifications
You must be signed in to change notification settings - Fork 263
Closed
Labels
status:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assignedtype:bugA broken experienceA broken experience
Description
Describe the bug
I am trying to add a page to our site and get an Invalid Request response.
I am using many other graph API commands just fine such as reading and uploading files and reading the currently available pages.
The permission in question set is: Sites.Manage.All.
I've tried many code permutations from MS doco, Copilot and the internet and all get the same error.
Authentication is via Microsoft Identity and the Graph API is obtained via AddMicrosoftGraphAppOnly.
I also tried using ClientSecretCredential which displayed the same error.
Expected behavior
Either an informative error, or the page to be added to the site.
How to reproduce
The code example is the following which is based on many internet examples (and copilot):
var page = new SitePage()
{
Title = "a page",
PageLayout = PageLayoutType.Article,
WebParts =
[
new TextWebPart
{
InnerHtml = "<p>This is a sample content.</p>"
}
],
PublishingState = new PublicationFacet()
{
Level = "published",
VersionId = "1.0"
}
};
var newPage = await api.Sites[siteId].Pages.PostAsync(page);
SDK Version
5.77.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Microsoft.Graph.Models.ODataErrors.ODataError: Invalid request
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponseAsync(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken)
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
at Microsoft.Graph.Sites.Item.Pages.PagesRequestBuilder.PostAsync(BaseSitePage body, Action`1 requestConfiguration, CancellationToken cancellationToken)
at Program.<Main>$(String[] args) in /Users/steven/Programming/src_w/GeosecureSupport/GeosecureSu//pport/Program.cs:line 115
at Program.<Main>(String[] args)
Configuration
- OSX Sequioa - latest
- M4
- DotNet 9.0 - latest
Other information
No response
Metadata
Metadata
Assignees
Labels
status:waiting-for-triageAn issue that is yet to be reviewed or assignedAn issue that is yet to be reviewed or assignedtype:bugA broken experienceA broken experience