Select theme:
This blog post demonstrates how to build with Radzen an Angular app that will access Microsoft OneDrive using Microsoft Graph API and Azure Active Directory authentication!
Create a new Radzen application, add MSGraph data-source similar to our article and add Files.Read
scopes/permissions.
getDrives()
method on page Load event and define two page properties getDrivesResult
for the returned data and drive
for the first drive in the collection.
getDrives()
call invoke MSGraph data-source getDrivesRoot()
method with ${drive.id}
as parameter and define page property rootId
to ${result.id}
.
getDrivesResult
page property and define two levels using microsoft.graph.drive
and microsoft.graph.driveItem
schemas. Set owner.user.displayName
for the first level Text property and name
for the second level Text property.
getDrivesItemsChildren()
method on Tree component NodeExpand event with three parameters:${drive.id}
.${event.level == 0 ? this.rootId : event.data.id}
. Provide rootId
or current node/item id
depending on level
.file eq null
. Filter drive items to return only folders.
Execute ${event.children = result.value}
after getDrivesItemsChildren()
method call.
${event.leaf = event.data.folder ? event.data.folder.childCount == 0 : false}
. The tree node will not be expandable if there are no children.
selectedFolderId
page property with value ${event.level == 0 ? this.rootId : event.data.id}
, invoke getDrivesItemsChildren()
method with two parameters:${drive.id}
.${event.level == 0 ? this.rootId : event.data.id}
.
and set page property selectedItemChildren
to ${result.value}
.
selectedItemChildren
and define desired columns. Check AllowSorting
and AllowFiltering
.
Enjoy!
Radzen is free to use. You can also test the premium features for 15 days.
Download NowSelect theme: