This article is contributed. See the original author and article here.
I was asked to share how I have been adding new OneNote tabs to a team channel in Microsoft Teams using Power Automate + Graph API. If you look at the documentation it shows you this:
Of course I never believed that but found earlier a way to hack OneNote into a channel as tab but also updated my methods when it became much simpler than before. In this blog post I show you the simple way how to add OneNote book as a tab.
- You need t use a Premium licensing if you are using Power Automate since this is done using Graph API calls.
- Set up Azure AD App Registration with application id and client secret with required permissions for OneNote and to adding a tab to create OneNote books and adding them to tabs.
- You need a team id and a channel id you want to put the OneNote book into as a tab
Adding a new notebook is done directly to the team. The creation is quite simple – I used the team name as part of the Notebook’s name.
Once you have created the notebook you need to parse the body for some important variabled.
I created the schema based on one creation body to retrieve essential info about notebook ID and also it’s weburl.
{
"type": "object",
"properties": {
"@@odata.context": {
"type": "string"
},
"id": {
"type": "string"
},
"self": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"displayName": {
"type": "string"
},
"lastModifiedDateTime": {
"type": "string"
},
"isDefault": {
"type": "boolean"
},
"userRole": {
"type": "string"
},
"isShared": {
"type": "boolean"
},
"sectionsUrl": {
"type": "string"
},
"sectionGroupsUrl": {
"type": "string"
},
"createdBy": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"displayName": {
"type": "string"
}
}
}
}
},
"lastModifiedBy": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"displayName": {
"type": "string"
}
}
}
}
},
"links": {
"type": "object",
"properties": {
"oneNoteClientUrl": {
"type": "object",
"properties": {
"href": {
"type": "string"
}
}
},
"oneNoteWebUrl": {
"type": "object",
"properties": {
"href": {
"type": "string"
}
}
}
}
}
}
}
The final piece is to use this information to add OneNote as a tab to a channel. For this you need the notebook id, the channel id along with the team id.
And that’s that.
Of course we could take this further by adding new sections and pages to the OneNote – or even content. But even as this is now this is very useful when doing a custom team provisioning. If you have premium licenses for Power Automate.
Instead of using Power Automate Premium this could be very well done with Azure Logic Apps, which can provide a cost-effective way to use occasional Graph API calls (it always depends): do the ROI calculation for your situation/platform.
This article is a repost from my blog.
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.
Recent Comments