How to clip the title of webpage to the OneNote?

Leung R 20 Reputation points
2023-01-26T06:15:58.3133333+00:00

I wanna clip this article ([https://www.bbc.com/news/entertainment-arts-64372274)to my OneNote.

The title is "Live music: How buying concert tickets could be made better" in this case.

My request body like below :

<div

  data-render-src="https://www.bbc.com/news/entertainment-arts-64372274"

  data-render-method="extract"

  data-render-fallback="none">

User's image

But the response is not included the title of webpage. The key of title is empty .

User's image

So how can I extract the title and add to the OneNote by API ?

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,992 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gopinath Chennamadhavuni 2,436 Reputation points
    2023-01-27T06:24:09.1733333+00:00

    Hi Leung R,

    As per the documentation, using the OneNote API we can extract the business card data from an image, or recipe and product data from a URL. Extracting the product data only works on the body part of the page. It cannot extract the details in section wise like page title, header, footer etc. To create a OneNote page with title we need to provide the Title tag explicitly in the request body along with the extract code. Below is the sample code.

    Request Header:
    Content-Type: application/xhtml+xml

    <!DOCTYPE html>
    <html>
      <head>
        <title>Test Title</title>    
      </head>
      <body>
    <div
      data-render-src=https://www.bbc.com/news/entertainment-arts-64372274
      data-render-method="extract"
      data-render-fallback="none">
      </body>
    </html>
    

    Please find he below screenshot for reference:

    NoteOne1

    Response after the Graph call execution:

    NoteOne2

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Gopinath Chennamadhavuni 2,436 Reputation points
    2023-01-27T06:23:42.25+00:00

    Hi Leung R,

    As per the documentation, using the OneNote API we can extract the business card data from an image, or recipe and product data from a URL. Extracting the product data only works on the body part of the page. It cannot extract the details in section wise like page title, header, footer etc. To create a OneNote page with title we need to provide the Title tag explicitly in the request body along with the extract code. Below is the sample code.

    Request Header:
    Content-Type: application/xhtml+xml

    <!DOCTYPE html>
    <html>
      <head>
        <title>Test Title</title>    
      </head>
      <body>
    <div
      data-render-src=https://www.bbc.com/news/entertainment-arts-64372274
      data-render-method="extract"
      data-render-fallback="none">
      </body>
    </html>
    

    Please find he below screenshot for reference:

    NoteOne1

    Response after the Graph call execution:

    NoteOne2

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.