PowerShell Graph SDK and Personal OneDrive

Last modified date

Comments: 0

I’ve spent an age going round the houses to find the right PowerShell Graph SDK commands to retrieve a list of the contents of the root of a Personal OneDrive (ie not OneDrive for Business!). I was trying get MgDriveItem, but some trial & error, plus using the Graph SDK Explorer eventually turned up the right commend

Connect-MgGraph -Scopes "files.read","User.Read.All"
$driveId = Get-MguserDrive -UserId me
Get-MgDriveRootChild -DriveId $driveId.id -debug

Remove the -debug parameter if you don’t want to see all the, erm, debug information

Chris

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.