microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

OneNote section includes deleted page #70

Open arcadiogarcia opened 5 years ago

arcadiogarcia commented 5 years ago

Please provide the following (and please check them off the list with [x]) before submitting this issue:

Expected behavior

In my app, I added a page to an existing OneNote section using the following code:

 OnenotePage page;
            string htmlBody = $"< !DOCTYPE html >< html >  < head >< title > </ title ></head>  <body></body></html> ";
            byte[] byteArray = Encoding.ASCII.GetBytes(htmlBody);
            using (MemoryStream stream = new MemoryStream(byteArray))
            {
                // Create a OneNote page.
                var emptyPage = new OnenotePage() { Title = "New page", Content = stream };
                page = await client.Me.Onenote.Sections[sectionId].Pages.Request().AddAsync(stream, "text/html");
            }

After doing so, the app was showing up as expected when listing the pages of the section and I was able to retrieve its content. Eventually, I deleted that page using the OneNote Windows 10 app. I would expect the page to not be returned in the graph results anymore.

Actual behavior

After deleting the page, any attempt to load that section with this code fails:

var pages = await client.Me.Onenote.Sections[sectionId].Pages.Request().GetAsync();
//Foreach section
var preview = await client.Me.Onenote.Pages[x.Id].Preview().Request().GetAsync();

For some reason the list of pages returned for the section still includes the deleted section, but when I try to get the preview I get this error:

{
    "error": {
        "code": "20102",
        "message": "The specified resource ID does not exist.",
        "innerError": {
            "request-id": "2a3768a7-685a-4b57-a1a4-c56a6c18a3b4",
            "date": "2019-02-25T00:17:11"
        }
    }
}

The error makes sense, since I deleted the page, but I don't understand why it is being returned when I list the pages. Is there some kind of "deleted" flag I should be using to filter the pages or is this a service bug?

Steps to reproduce the behavior

I'm using version 1.12.0 of the sdk

AB#7318

arcadiogarcia commented 5 years ago

I'm experimenting a bit more with the Graph explorer and looks like if I do GET https://graph.microsoft.com/v1.0/me/onenote/pages/<PAGEID> It actually returns some metadata (id, title, date modified...), but if I try to do DELETE https://graph.microsoft.com/v1.0/me/onenote/pages/<PAGEID> it tells me

{
    "error": {
        "code": "20113",
        "message": "The specified resource has been deleted.",
        "innerError": {
            "request-id": "b80fbb6f-d0ae-47cc-8e05-7d2c172f4c87",
            "date": "2019-02-25T00:36:09"
        }
    }
}
arcadiogarcia commented 5 years ago

Ok, I think I found out what is happening, I followed the oneNoteClientUrl to see what would the OneNote app do (since according to it the page is already deleted), and it brought me to a special "Deleted pages" section. According to it:

image

So it would seem that the page is stuck in that limbo, where the API lists it as an existing page but it won't allow me to access the preview or delete it. How are API users expected to filter out these pages? I would expect some kind of flag indicating that the page is deleted.

MIchaelMainer commented 5 years ago

@billpetrakos Can you answer this question about how to determine whether a page has been deleted with the API?

manjushm-microsoft commented 5 years ago

As you said, it seems like the problem is that the deleted page is in that special "Deleted pages" section. I will try to fix our API for this scenario. Meanwhile, you can restore the page and then delete it from OneNote Online or using our Delete-page API at https://docs.microsoft.com/en-us/graph/api/page-delete?view=graph-rest-1.0

That should fix your Pages query

MIchaelMainer commented 5 years ago

@manjushm-microsoft Thank you for the response. Can you update your internal tracking item with a link to this issue so that you can follow up here when this is resolved?

MIchaelMainer commented 5 years ago

@manjushm-microsoft Has the API been fixed for this scenario?

manjushm-microsoft commented 5 years ago

Sorry, we actually "Won't Fix"ed it since there is a work around for this

arcadiogarcia commented 5 years ago

@manjushm-microsoft What is the workaround? If it is the one you mentioned earlier in the thread it works for testing but it is not a valid workaround for real scenarios, since the end user is the one that has to go through the page restoration steps.

AndroidGecko commented 5 years ago

found the same bug within Android SDK, IOS SDK and even MS Graph Explorer.

https://stackoverflow.com/questions/58557597/onenote-api-get-list-of-pages-from-section-filtering-out-the-deleted-pages

@manjushm-microsoft could you share what is the workaround? @arcadiogarcia were you able to resolve this?

This makes the whole OneNote API simply unusable as there is no way to distinguish between deleted sections or notes from the existing ones.

arcadiogarcia commented 4 years ago

@AndroidGecko I wasn't able to resolve this :( @manjushm-microsoft can you point us to a valid workaround? This is a BIG blocker for developing apps that list OneNote pages.

manjushm-microsoft commented 4 years ago

Alright let me check with my team if we can bump up the priority of this issue. I will let you know. Thanks!

petrhollayms commented 6 months ago

Thank you for reporting this issue. This appears to be an issue or limitation with the service APIs. Unfortunately, as the Microsoft Graph SDK team, we do not have ownership of the APIs that are causing you issues. We invite you to create a question about the service API to Microsoft Q&A and tagged with one of the [microsoft-graph-*] tags, that way it will get routed to the appropriate team for them to triage:

https://aka.ms/msgraphsupport or directly https://aka.ms/askgraph

For now, we will close the issue on our side but feel free to open it in the relevant repository if you think the issue is specific to SDK. Please let us know if this helps!

Note: We will close this repository on April 19, 2024.