web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create OneNote noteboo...
Power Automate
Unanswered

Create OneNote notebook as a tab in Teams

(0) ShareShare
ReportReport
Posted on by 85

I have a flow that uses a Custom Connector because we have MFA enabled and a pr. user license. The flow is supposed to create a Notebook and add it as a tab on the General channel on a team. The problem is, that I'm getting the error "Invalid version: https:" but I don't know which url is the problem. I hope you can help.

note1.jpg

 

Additional info:

Add TAB URI
https://graph.microsoft.com/v1.0/teams/345f05fb-181e-45aa-9b89-1b70e17d0ef1/channels/19:RokO6-5gUkI1AtbBUOnTPl0POkghwQV0Etwhc5mYC4c1@thread.tacv2/tabs

Notebook URL (To be used as Website URL)
https://MYDOMAIN.sharepoint.com/sites/TestNotebook/Shared%20Documents/Notebooks/Test%20Notebook

Content URL
https://www.onenote.com/api/v1.0/myOrganization/siteCollections/68849b56-647d-4797-be3d-543303a541eb/sites/caeadb6d-0881-42d3-8e24-ae7f88bcaf22/notes/pages/1-4c1f0c63337d4146bc1772169f82d5bb!11-812613b9-22f1-4af3-97f1-12a914cc865a/content

I found out that the content URL could be retrieved like this:

note2.jpg

 

The custom connector resembles the HTTP connector found here:

note3.jpg

 

It is worth mentioning that the guide that I have linked to above is old and uses URLs that cannot be used anymore. In other posts refers to this powershell script thet shows the "new" correct contentURL structure. As stated above I have found a way to retrieve it by using the Noebook connector "Get pages for a specific section". I asume that this is OK?

 

 

If you have any questions please ask. I need to resolve this 🙂

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @PowerSA,

     

    As far as I am aware the add tab to channel Graph API method uses a teamsApp@odata.bind property with a hyperlink value to refer to the correct app. You can append the correct appid in that hyperlink value.

     

    For the OneNote app that is the teamsAppId is 0d820ecd-def2-4297-adad-78056cde7c78 (which you were already using).

     

    Below are the docs for the add tab to channel method:

    https://learn.microsoft.com/en-us/graph/api/channel-post-tabs?view=graph-rest-1.0#request

     

    Can you try the below syntax instead?

     

     

    POST https://graph.microsoft.com/v1.0/teams/{id}/channels/{id}/tabs
    
    {
     "displayName": "My OneNote Tab",
     "teamsApp@odata.bind": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/0d820ecd-def2-4297-adad-78056cde7c78",
     "configuration": {
     "contentUrl": "@{variables('NotebookURL')}",
     "websiteUrl": "@{variables('NotebookURL')}",
     }
    }

     

     

     

  • PowerSA Profile Picture
    85 on at

    Hi @Expiscornovus , thanks for your swift reply.

     

    I did look at the teamsApp@odata.bind property, but didn't quite figure out how to use it here. I have now tested the suggested body, but the error is still the same:

    note5.jpg

     

     

  • PowerSA Profile Picture
    85 on at

    ...and I have now tried with the full URL, but still no cigar

     

    Minor update: I also tried with the beta framework instead of v1.0, but it still fails the same way.

     

    note6.jpg

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @PowerSA,

     

    Might be a custom connector issue? Can you try the same request/payload in the Graph explorer?

     

    1. Navigate to https://aka.ms/ge

    2. Logon as the same account you are using within your custom connector testing

    3. Run that same Uri and body payload to create the tab

  • PowerSA Profile Picture
    85 on at

    Well, it seems OK, but the tab is not being created..  also, as far as I know, 200 only means "Recieved OK", not "Processed OK".

    note7.jpgnote8.jpg

     

    I have tried to enter the content URL and I get an access token error. That might be because I run it in a https session that has not been auth'ed like my flow and graph has?

    note9.jpg

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @PowerSA,

     

    Yeah, you should get a 201 with response details. Below is my test sample with some details obfuscated. Maybe that helps?

     

    As you can see I used a onenote.com url with a tabredirect for the websiteUrl property.

     

    onenote_tab.png

  • PowerSA Profile Picture
    85 on at

    Hi @Expiscornovus 

    It sounds very good that it is possible 🙂 I just need to have two things clearified:

    1. What is a Tabredirect? I have googled it and I see something about an Edge extention, but that can't be it, or?

    2. How do I use Tabredirect with the data I have avaliable as dynamic data, after I created my Notebook?

     

    My flow looks like this:

    note10.jpg

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @PowerSA,


    It looks like it just redirects you to the Online version of OneNote, which can be rendered as a tab on Microsoft Teams and opens the notebook in that version.

     

    Try something like below in your websiteurl field:

    concat('https://www.onenote.com/teams/TabRedirect?redirectUrl=', variables('NotebookURL'))

     

     

  • PowerSA Profile Picture
    85 on at

    Hi @Expiscornovus 

    Thanks a bunch for staying with me on this. I have now tried your suggestion, but the error is still the same. In order to get the righjt URLs (onenote.com), I have dropped working on a self-created notebook and instead hooked up on the default notebook. 

    My input is like this:

    {
        "host": {
            "connectionReferenceName""shared_iw-20create-20notebook-20on-20team-5f6488149dd6-176dbc52786c2ccc",
            "operationId""AddTab"
        },
        "parameters": {
            "Content-Type""application/json",
            "body/displayName""Test Notebook",
        }
    }

    The error still looks like this:

    Note11.jpg

     

    {
      "error": {
        "code""ResourceNotFound",
        "message""Invalid version: https:",
        "innerError": {
          "date""2023-03-29T08:02:30",
          "request-id""83d9627e-1d3e-48de-a6ff-a90276a2b8cc",
          "client-request-id""83d9627e-1d3e-48de-a6ff-a90276a2b8cc"
        }
      }
    }
     
     

     

  • PowerSA Profile Picture
    85 on at

    Hi @Expiscornovus 

    Thanks a bunch for staying with me on this. I have now tried your suggestion, but the error is still the same. In order to get the righjt URLs (onenote.com), I have dropped working on a self-created notebook and instead hooked up on the default notebook. 

    My input is like this:

    {
        "host": {
            "connectionReferenceName""shared_iw-20create-20notebook-20on-20team-5f6488149dd6-176dbc52786c2ccc",
            "operationId""AddTab"
        },
        "parameters": {
            "Content-Type""application/json",
            "body/displayName""Test Notebook",
        }
    }

    The error still looks like this:

    Note11.jpg

     

    {
      "error": {
        "code""ResourceNotFound",
        "message""Invalid version: https:",
        "innerError": {
          "date""2023-03-29T08:02:30",
          "request-id""83d9627e-1d3e-48de-a6ff-a90276a2b8cc",
          "client-request-id""83d9627e-1d3e-48de-a6ff-a90276a2b8cc"
        }
      }
    }
     
     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard