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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create a section in On...
Power Automate
Answered

Create a section in OneNote and then create a page within this section

(0) ShareShare
ReportReport
Posted on by 57
 Hello,
 
I've seen posts on this topic before and looks like this one might have had a solution provided by plessor88 but unfortunately the screenshots are not loading for me. 
 
I have a flow where I check if the section already exists or not and 
1. If it does not exist then create Section in OneNote and then a page in that new Section
2. If if does exist, then create a page under that Section.
 
I'm able to create a section or check if the section exists, but it fails for me to create a page under that section. I can't figure out what variable to use to reference that section.
 
Any guidance would be greatly appreciated. 
 
Tatyana
 
 
Categories:
I have the same question (0)
  • Verified answer
    Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    You can use a Filter Array action to check if the section already exists and use the pagesUrl property to reference the right section.
     
    Below is an example, if that helps?

    1. Filter Array action uses the value of the listed sections of the Get sections in a notebook action and checks if the name is the same as the one of the SectionName variable.
     
    2. The Condition checks if no matches are found (aka is equal to 0), this is done by using a length function.
    length(body('Filter_array'))
     
    3. If Yes, both the Section and Page are created
     
    4. If No, only the page is created and uses the below expression for the Section reference
    first(body('Filter_array'))['pagesUrl']
     
     



     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • Tatyana Profile Picture
    57 on at
     than you so much for your post! With your help I was able to create pages within a section if the section already exists, however, I am still struggling with creating new pages within a brand new section that was just created. Using The pages URL did not work for me. I can't figure out what I am doing wrong.
     
    The purposes of my flow is to run automatically on daily basis. What I am trying to accomplish is on daily basis grab all my calendar events for the day and create a page for each calendar event. Right now, I'm just trying to create section for each month and then a page for each day under that month section. However, ideally I would like to have Section Group for the month, then Sub Sections for each week for that month and pages for each day under week section. I'm not sure if this is possible as I don't see the option to create Section Group in Power Automate.
     
    Here are the screenshots of my flow. If you don't mind taking a look, I'd really appreciate help identifying what I might be doing wrong.

    1. Getting calendar events
     
     
    2. Initializing variables for OneNote. Setting SectionName value to today's year-month
     
     
    3. Getting all the sections from OneNote and placing then in the array. Checking whether the section already exists
     
     
    4. If it doesn't exist, create new Section with today's year-month as the name. Wait 10 seconds before moving to the next step (This part creates new section in OneNote)
     
     
    5. Create Page under the new Section (but this part fails to create the page in that new Section. See screenshot of the error below)
     
     
    6. If Section already exists, create page under that section (this part works)
     
     
    This is the error that I'm getting
     
     
    Thank you in advance.
     
     
  • Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    It looks like the Create a page in section action has a convertTimeZone function. Are you using that in the concat expression in that Page Content field?

    If so, can you please share that expression? The error suggest that the value you are using in that function is empty/null, that is why it is failing.
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • Tatyana Profile Picture
    57 on at
     
    Yes, I'm using concat expression in the Page Content field.
     
    concat('<h1>', item()?['subject'], '</h1><p><b>📅 Start Time:</b> ', formatDateTime(convertTimeZone(item()?['start'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt'), '</p><p><b>⏰ End Time:</b> ', formatDateTime(convertTimeZone(item()?['end'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt'), '</p><p><b>📍 Location:</b> ', item()?['location'], '</p><p><b>👤 Organizer:</b> ', item()?['organizer'], '</p><p><b>👥 Attendees:</b> ', item()?['requiredAttendees'], '</p><hr/><h2>Meeting Notes:</h2><p>Add your notes here...</p><h2>Action Items:</h2><p>☐ </p><p>☐ </p><h2>Follow-up:</h2><p>Add follow-up items here...</p>')
     
    However, this is not failing if the Section already exists. It creates new Page within that Section successfully. 
  • Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    I see the action refers to the start field of the item. However, it is a nested loop so it would try and find the start field on the Apply to each 2 loop items. Over there the start field doesn't exist.
     
    The start field exists in the Apply to each loop items though.
     
    formatDateTime(convertTimeZone(item()?['start'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt')
     
    My suggestion would be to use the items instead of the item function for your start field reference (and also the other fields you are using in the concat).
    formatDateTime(convertTimeZone(items('Apply_to_each')?['start'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt')
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • Tatyana Profile Picture
    57 on at
    Thank you, unfortunately its not letting me save the changes. Getting the following error
     
  • Verified answer
    Expiscornovus Profile Picture
    33,828 Most Valuable Professional on at
     
    What did you use as the concat function? Did you include the name of the action in the loopname parameter of the items function?
     
    In your setup I would expect something like the below:
    concat('<h1>', items('Apply_to_each')?['subject'], '</h1><p><b>📅 Start Time:</b> ', formatDateTime(convertTimeZone(items('Apply_to_each')?['start'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt'), '</p><p><b>⏰ End Time:</b> ', formatDateTime(convertTimeZone(items('Apply_to_each')?['end'], 'UTC', 'Eastern Standard Time'), 'dd-MM-yyyy hh:mm tt'), '</p><p><b>📍 Location:</b> ', items('Apply_to_each')?['location'], '</p><p><b>👤 Organizer:</b> ', items('Apply_to_each')?['organizer'], '</p><p><b>👥 Attendees:</b> ', items('Apply_to_each')?['requiredAttendees'], '</p><hr/><h2>Meeting Notes:</h2><p>Add your notes here...</p><h2>Action Items:</h2><p>☐ </p><p>☐ </p><h2>Follow-up:</h2><p>Add follow-up items here...</p>')
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • Tatyana Profile Picture
    57 on at
     thank you so much! I saw some other issues in my logic that I was able to fix, but couldn't have done it without your help. 
     
    Greatly appreciated!
     
     
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard