Microsoft OneDrive CLI
for cmdhub.
OneDrive files, folders, metadata, trash, and sharing permissions through Microsoft Graph.
cmdhub get msdrive
data_object Agent Contract
Agents should start with auth/status and discovery commands, inspect schemas before composition, and treat commands marked as mutating as state-changing operations.
Output
Use human output for reading, `--json` for one object, and `--jsonl` for pipes.
Auth
Microsoft OAuth. Used for OneDrive files, folders, and permissions.
Refs
Prefer list/search, then short refs or piped JSONL. Use `resolve` to inspect cached refs.
Schemas
Use `msdrive schema` and `catalog.json` to inspect fields, flags, examples, and side effects.
Auth scopes
offline_accessUser.ReadFiles.ReadWriteterminal Command Reference
Generated from source. Global flags apply to all commands.
Global Flags
--json
bool
Emit JSON machine output--jsonl
bool
Emit JSONL records for piping--output, -o
string
Compatibility output mode: json|jsonl. Prefer --json or --jsonl--view
string = summary
View mode: summary|full--profile
string = default
Config/auth profile--config
string
Config path override--quiet, -q
bool
Suppress non-essential diagnostics--debug
bool
Enable debug diagnostics--limit
int = 50
Maximum items to emit--page-size
int = 50
Requested upstream page size--cursor
string
Continuation cursor--no-paginate
bool
Fetch only one page--version, -v
bool
Print version informationmsdrive auth
Manage Microsoft OneDrive authenticationmsdrive auth login
Authenticate with Microsoft OneDrivemsdrive auth logout
Remove stored credentialsmsdrive auth refresh
Refresh stored tokenmsdrive auth status
Show auth statusmsdrive auth whoami
Show current OneDrive identitymsdrive capabilities
Describe capabilitiesmsdrive config
Inspect local configurationmsdrive config explain
Explain resolved configurationmsdrive doctor
Run msdrive diagnosticsmsdrive file
Manage OneDrive filesmsdrive file delete
Permanently delete a file--all
bool
Confirm batch permanent deletion--file
string
File selector--yes
bool
Confirm permanent deletionmsdrive file download
Download file bytes--file
string
File selector--out
string
Output path. Omit to print content.msdrive file export
Export a Microsoft Office file--file
string
File selector--mime-type
string = pdf
Export format or MIME type--out
string
Output path. Omit to print content.msdrive file get
Get file metadata--file
string
File selectormsdrive file list
List files--folder
string
Folder selector--query
string
Name/full-text query--trashed
bool
Include trashed filesmsdrive file search
Search files by name or text--folder
string
Folder selector--query
string
Name/full-text query--trashed
bool
Include trashed filesmsdrive file trash
Move a file to trash--all
bool
Confirm batch trash--file
string
File selectormsdrive file untrash
Restore a file from trash--all
bool
Confirm batch untrash--file
string
File selectormsdrive file update
Update file metadata or parents--add-parent
stringSlice = []
Folder selector to add as parent--description
string
New description--file
string
File selector--name
string
New file name--remove-parent
stringSlice = []
Folder selector to remove as parent--starred
bool
Set starredmsdrive file upload
Upload a local file--description
string
File description--folder
string
Parent folder selector--mime-type
string
Content MIME type--name
string
OneDrive file name--path
string
Local file pathmsdrive folder
Manage OneDrive foldersmsdrive folder create
Create a folder--description
string
Folder description--name
string
Folder name--parent
string
Parent folder selectormsdrive folder get
Get folder metadatamsdrive folder list
List folders--query
string
Folder name query--trashed
bool
Include trashed foldersmsdrive folder search
Search folders by name--query
string
Folder name query--trashed
bool
Include trashed foldersmsdrive login
Authenticate with Microsoft OneDrivemsdrive logout
Remove stored credentialsmsdrive permission
Manage OneDrive permissionsmsdrive permission add
Add a permission--allow-discovery
bool
Allow public/domain discovery--domain
string
Domain for domain permission--email
string
Email address for user/group permission--file
string
File selector--role
string = reader
Permission role: reader|commenter|writer--type
string = anyone
Permission type: user|group|domain|anyone--yes
bool
Confirm broad anyone/domain sharingmsdrive permission list
List file permissions--file
string
File selectormsdrive permission remove
Remove a permission--all
bool
Confirm batch permission removal--file
string
File selector--permission
string
Permission selector--yes
bool
Confirm permission removalmsdrive profile
Manage provider profilesmsdrive profile create
Create an unauthenticated provider profilemsdrive profile delete
Delete a local provider profilemsdrive profile list
List provider profilesmsdrive profile rename
Rename a local provider profilemsdrive profile use
Set the default provider profilemsdrive resolve
Resolve a marker or short idmsdrive schema
Emit msdrive schema hints--in
bool
Show input schema--input
bool
Show input schema--out
bool
Show output schemamsdrive version
Show msdrive version informationplay_circle Live Examples
Output captured from a real workspace. Regenerate with
scripts/gen-docs.sh --update.
auth
Authenticated as kestrelphilip@outlook.com Next steps: - Files: msdrive file list --limit 10 - Folders: msdrive folder list --limit 10 - Capabilities: msdrive capabilities
files
REF TITLE WHEN
f1 Documents Wed 29 Apr 05:31
f2 OneDrive Eval Folder {id} Wed 29 Apr 05:59
f3 OneDrive Eval Folder {id} Wed 29 Apr 06:00
f4 OneDrive Eval Folder {id} Wed 29 Apr 06:50
f5 OneDrive Eval Folder {id} Wed 29 Apr 07:06
Next steps:
- More: msdrive file list --cursor https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken={id}
- Open: msdrive file get f1
- Search: msdrive file search --query <text>
- Files: msdrive file list --limit 10REF TITLE WHEN
f1 OneDrive Eval Folder {id} Sun 17 May 14:09
f2 OneDrive Eval Folder {id} Sun 03 May 08:37
f3 OneDrive Eval Folder {id} Wed 29 Apr 19:12
f4 OneDrive Eval Folder {id} Thu 30 Apr 12:00
f5 OneDrive Eval Folder {id} Thu 30 Apr 12:29
Next steps:
- More: msdrive file list --cursor https://graph.microsoft.com/v1.0/me/drive/root/search(q='eval')?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken=Ng
- Open: msdrive file get f1
- Search: msdrive file search --query <text>
- Files: msdrive file list --limit 10folders
REF TITLE WHEN
d1 Documents Wed 29 Apr 05:31
d2 OneDrive Eval Folder {id} Wed 29 Apr 05:59
d3 OneDrive Eval Folder {id} Wed 29 Apr 06:00
d4 OneDrive Eval Folder {id} Wed 29 Apr 06:50
d5 OneDrive Eval Folder {id} Wed 29 Apr 07:06
Next steps:
- More: msdrive folder list --cursor https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken={id}
- Open: msdrive folder get d1
- Search: msdrive folder search --query <text>
- Files: msdrive file list --limit 10alt_route Composition Patterns
Bridge your ecosystem with zero middleware.
msdrive auth login
# Search for a file, inspect metadata, then list its sharing permissions
msdrive file search --query "project notes" --limit 1 --jsonl \
| msdrive file get
msdrive permission list --file f1
# Upload into a folder discovered from a pipe
msdrive folder search --query "Project docs" --limit 1 --jsonl \
| msdrive file upload --path ./notes.txt --name notes.txt