
I'm a Microsoft MVP and the partner and CEO of canvas consulting.
In this video I'm going to show you how to export content
from PowerApps to OneNote notebooks.
To demonstrate this concept, I'm going to use the meeting capture PowerApps
sample template. You can find
this same exact PowerApps sample template at web.powerapps.com.
I encourage you to look at the different videos I've created for this particular PowerApp
sample template. I have a video that shows you how to download
Install, and configure, another that gives you
a complete walk through of all the functionality in it, and then another one that
is deep dive on a different concepts within the app itself so when you first load up.
The meeting capture PowerApp looks like this and it shows you the meetings
on your calendar you can scroll through and take a look at all the different
upcoming meetings once you select meeting like I've done here for the one
called canvas chrome click start meeting.
Now here inside of the application I'm going to
add-in notes for my meeting.
Right here.
And, I'm also going to add-in a task and the
reason I'm adding both of these things in is because I want to show you how
when we exported to one note this information for the attendees and
meeting the title, the time and the date
meeting took place the details about the meeting the notes you took
as was the planner tacit you've created all are exported to one node right
click the plus button here to create a plane or task allows me to pick a due
date and assign a person to do it all assign myself in this example.
The application also gives you the capability to use the
sketch pad here to draw sketches.
Or to click on the image for the camera and to take a picture
on your device and put that with the meeting notes as well.
Those two items are not able to be exported to one node at
this time just the information you see on the screen when you done taking notes you click
finish and save.
And, then I'm going to come over and unchecked email and notice it tells us we're
going to lose attachments if we don't put them on email but that's not what I'm demonstrating
in this video so I'm just going to focus on the one node and planner integration here.
When I click one no I'm prompted to select a location?
Here I can see a drop-down list that shows me all the different
one note notebooks I have access to and might org.
Once you
select a notebook then you can see the different sections inside of that notebook
where you can create your new page for these notes that come from the meeting capture our up.
The planar integration follows the same pattern where it allows me to pick a different
plan where I'd like to put these items and then a bucket within that plan.
I click OK there as well. Now I'm ready to
do my export click the export button at the top
and prompted from. I'm all done, and I click
us to continue at this point the export takes place and
we can see the text change the top as the export took place and now the
export is complete so now let's take a look at where that information went into one of.
Flipping over to one note now I can see
my one no notebook with the same name I selected empower up in
the quick note section and here's the page that was created.
I've done this several times and PowerApp, so you can see an idea of how it
looks for different meetings that I've exported over time.
The one I most recently exported was this one that you
saw me previously working with the video.
Here you can see here identifies it came from the meeting capture
has the date and the time and the name of the meeting who attended
and their titles and it also has the meeting notes that I took as well
as a link to the planner so I can go look at the task.
Notice that when I click this link as you can see in the URL it's just going to
test our office dot com at this time it's not possible to link all the way
down to an individual task without running a lot of different code inside
of the our up to figure out the id for that task so we just take some of the task
start office dot com you can see the due date is was who it's a
sign to is also reflected in this export to one node.
Just to cover the bases here here's where the task was created
inside of that our apps and flow applications plan I had in the
to do bucket I selected earlier.
So, now that we've seen how this export to one node took
place let's dig in and look at the code that made it happened the first
piece of the puzzle was when we actually selected where we wanted to export the
information to inside of a particular one node notebook.
To do this functionality.
When the export screen becomes visible
beyond visible function runs as you can see it the very top here first
we�re creating a collection with the clear collect function?
If you knew our apps and haven't seen this function before what this function does is
creates a collection with the name of the first argument you pass into it here email
recipients and then it here passes
in the items that she would like to fill this collection worth this is used to
populate all the different people who will be emailed had we selected
the export to e-mail to actually populate the list of notebooks to
allow users select them and drop-down list we create?
Another collection called one note books.
First, we check if it's empty if it's empty then we're going to
create if it's not empty then we're not going to created again this cuts down on
API calls because we really only need to see which, you know,
books the user has access to one-time as they load the screen and the app.
We use the clear collect
here to create the one note notebooks collection.
Here we're calling out to the one
no business connector if I click the view.
Button at the top and then select data
sources inside of my data sources tab I can see my OneNote
connector note that the name
of OneNote parentheses business close parentheses is exactly
the same as the name up here that's always the case
when we have a connector and we call it from code.
Its name always match exactly what you see here and the data pain.
The method that were invoking on the one no business connector is
called get notebooks as you can see right here get notebooks will return
all the notebooks the user has access to that's how we create the
one no notebooks collection we do the
same thing for the one sections collection.
But, here what we do is we getting is the one
note business connector but we call get sections in the book.
And, here we passed send the key to the notebook
notice one note notebooks select is in purple here.
That's the name of the control that has to purple box thrown
around here at the bottom so the selected items key.
Is the value that we're going to pass
into get sections and notebook to return
just the sections that correlate to the currently selected one notebook.
Now as I click on these different controls down here
at the bottom and I highlight this drop-down list you can see it's item
collection is the one note notebooks that's the collection where we return
all the notebooks and this collection here is the one note sections
within that notebook that was currently selected so that's how you can see how
we return the notebooks and sections where we're going to export the information to?
The next piece of the puzzles what happens when the user clicks the okay button on this
pop up like box dialogue here we run an f statement to say if
show one or show planner or show overlay show one note
show planner and show overlay are set to true
whenever you click the select new location here
or here so it pops the appropriate overlay control to
allow you to interact with that data source and the one node scenario show one node is
true and that's why this particular dialogue is visible.
First thing we're going to do is set
it to false that will hide this dialogue then we're going to set
a variable called selected notebook that variable is going to
be equal to as you can see again here the purple color helps a cell one note
notebooks select is the name of this control so we're going to grab its selected item
in there and said it as the selected notebook.
We do the same thing here for the selected section
but it comes from the item below it right here.
The next piece of the puzzle is going to be for the export button
in the top right corner of the page so I'm going to put the outback and preview mode
closes style log here and then bounce back into edit mode now
I can select the export button and the top right.
This pattern that I'm using of being inside of the PowerApps
editor and bouncing back between preview mode
and edit mode is a very good pattern that you can use to investigate any PowerApp,
especially the ones that we've created that you will find at web.powerapps.com
it allows you to populate at runtime all the collections
and variables that data and then inspect them later and step through
the app quickly as you bounce back and forth to look at the code so if we take a
look at the export button here we can see that the code
inside of it says set overlay equal to true.
The overlay true when it becomes true.
As you'll see right when I click this and preview mode here that's going to pop this screen
right there so that's my overlay that we're talking about there now if I click
yes, continue here and select that button.
Now we can see the logic that's going to occur on
us continue.
It's also setting and one more time to make
sure, that the selected notebook and the section are set and then
it's going to turn off the overlay and move on to the confirms screen.
So, when I go back to play mode here?
And, I click yes continue.
Now the export is occurring you can see it's working on it and
now as completed so how did that happen automatically when I came
that page if we look at the confirms screen.
And, we look at its own visible event here.
Here we can see all of the logic that actually
does our export to the various locations first we checked?
export confirmed if export confirmed is true like we
saw set in the previous page then we're going to run this code otherwise we're not going to
run the next thing is we set loading equal to true loading
is what change the message at the top of the page has it worked on the export the
one node specific functionality is at
the bottom here and we can see check one node
remember where we set that value and that was when they had the check box to say they
wanted to export to one note if that value is true which means the check box
was checked then we're going to execute the code
down here to actually do the export to one node so now we have a clever little pattern
in here that's going to allow us to build the template that creates the html
needed to create the page inside a one node.
And, we've set this up so that you basically you are creating a
name value pair collection with the dynamic values you'd like to inject
into that template let me show you how it works you'll notice here the first thing we
do when we process to one node is this for all statement
against this template data collection so we're looping through all the rows
and this collection then we're going to patch.
The templates collection.
By looking up into the
templates collection and finding the one note template where then going
to substitute the values that we pass in that match.
The template data inside of the
one note template so where did all this come from where you may have already notice the temple
data collection is created inside this page here.
Temple data if we look at it here at
run-time by going to file collections.
We confine the temple data collection right here this basically shows
you the name value pairs we've created so we have a name value pair with
a field.
Has the open
square goal meeting name close square goal and this one is our data of canvas
groom the meeting start date is may eighth so on so forth?
We've also got the different templates the templates that we're working with
book like this we have one for email and one for one node.
We can actually see into the data here unless we pull this
down a bit but once we pull it down a little bit
we can find some of the values inside here that were replacing.
Actually, having a hard time getting this to pull down far enough very
quickly so I'm going to show you the same concept as it happens inside of the
e-mail template
see the meeting name up top with the squiggles and.
If we come back to temple data here, you can see the same exact
field so essentially what's happening is we're taking the values from this
collection that are dynamically generated at run-time.
And, we're injecting them into the templates here when we
send emails or we create the html to create the one note page.
You're probably wondering where we created that templates collection that actually held all
of the html them we use to send emails in the one notes
well that's done in the army visible method inside of the welcome screen that I
have selected here this is the first screen you get to when you come in the app that's
only build these templates into the templates collection here you can see
our template named email and here is its value so
here is that meeting name placeholder we saw before
you probably notice I highlighted this one
it also appears here and here where it turned blue.
Now as we come down further we can see here is the template we created for one
note and here is our meeting name placeholder within it here's
meetings start time for instance of meeting and time.
all that html right there is what is used to create
this right here so at the top here's our meeting name for the title and
again, the meeting name there, here's our meeting start time and
the end time so that's how that html was used along with this
pattern of putting it into a collection and then replacing it with the
four all statement that we saw inside of the export screen here.
Are part of me it's inside of
the confirm screen that we're looking at here so this line of code
before all statement is the one that basically takes the temple data
at the top which is all the information like the selected
meetings start date and they how long the meeting was here we
loop through all of the meeting attendees and build-up one
row after another so that they can be displayed
on top of each other inside
of that export and then down here the one for number to
this particular item is actually building up all of the different tasks.
That were created
inside of the our up and eventually exported planner as well.
So, after we've got all that done.
We have our templates.
One note temple in split particular we
have that patched up inside of our template data collection.
So, finally to exporting information to one
note again we use the one node for business connector
we call create page in section this time.
We pass in the selected notebooks key.
The selected sections URL.
That correlate to the id you can see up here as you
look at the arguments for this particular method the section ideas what's called the pages you are
all property here and then we're going to look up in that templates collection return the one the
template and use its value is the page content that we actually use to
create.
When we're all done we set loading equal to false and by doing
It returns this label at the top of the page to say export complete.
Now you may be looking at this pattern and wondering to yourself well I could have done
all this without to collections and just use ampersand to limit
the text within it that's certainly true you could do that but we like to show
this pattern because in this example everything is done within the PowerApp,
but what if you needed to call out to an external data source
or configure your our up such that people who were not able to edit the PowerApp
could edit the template or these values
in the email this pattern would allow you to do that by calling out to another data source such
as Excel or CDS or dynamics or anywhere you can
actually, store data and get it from a PowerApp so that's why we
chose to implement this pattern and demonstrate how that can be done and how you
can separate the temple you have from the data that goes inside of it?
We hope that you find this pattern helpful and it allows you
to build applications that allow you to export data to one
note and automatically create pages in it as well and we also hope you really find this
meeting capture sample helpful thanks for watching the
video tape you got a lot out of it I'll see you next time.
End-to-End Demo of Meeting Capture End to end demonstration of PowerApps Sample - Help Desk Explore formulas (1-4) Managing entity data (4-4) Best Practices for Transitioning from Infopath to PowerApps Common Data Service security (4-5) Add data source and flow (2-4) Welcome to PowerApps How to export content from PowerApps to OneNote using Meeting Capture