Skip to content

OneNote Pages not being returned using contentUrl #107

Closed

Description

I have tried using the page.contentUrl to return the page content using the client get command and the getStream to no avail. I would appear the get command the result is undefined while the getstream just produces an empty file when trying to write the stream to file.

Activity

  1. muthurathinam commented on Sep 10, 2018

    @muthurathinam
    Contributor

    Thanks for reporting this issue. will look into this.

    876747

  2. juniorfoo commented on Dec 22, 2018

    @juniorfoo

    Setting the response type to TEXT should do it for you.

    client.api(ms_page.contentUrl).responseType(ResponseType.TEXT).get();

  3. muthurathinam commented on Jan 23, 2019

    @muthurathinam
    Contributor

    Sample code to download OneNote content (Assuming you have OneNote pages):

    const downloadOneNoteContent = async () => {
        try {
            let pagesResponse = await client.api("/me/onenote/pages").get(),
                pages = pagesResponse.value;
            let content = await client.api(pages[0].contentUrl).get();
            console.log(content);
        } catch (error) {
            console.error(error);
        }
    };

    Fixed in this release: https://github.com/microsoftgraph/msgraph-sdk-javascript/releases/tag/1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions