Trigger this skill for any action on the user's personal OneDrive — their own private Microsoft 365 cloud storage ("My files"), referred to as "onedrive", "onedrive cá nhân", "onedrive của tôi", "trên onedrive", "lên onedrive". Fire the moment a request names OneDrive and wants to do something with files or folders there: liệt kê/xem (list/browse), tạo/đổi tên/di chuyển/sao chép/xóa (create/rename/move/copy/delete) files & folders, tải lên (upload local files), tải về (download), tạo/gỡ link chia sẻ (share links), xem dung lượng trống/quota (free space), khôi phục bản cũ (restore an earlier version). Casual, terse, or unaccented phrasing still counts — just proceed, don't ask which storage they mean, and treat it as cloud storage rather than a local file task. This is INDIVIDUAL cloud storage, NOT a team site: send a team/group's "Shared Documents" or Files-tab documents to m365-sharepoint, Teams chat/channels to m365-teams, and Google Drive to gws-drive.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Trigger this skill for any action on the user's personal OneDrive — their own private Microsoft 365 cloud storage ("My files"), referred to as "onedrive", "onedrive cá nhân", "onedrive của tôi", "trên onedrive", "lên onedrive". Fire the moment a request names OneDrive and wants to do something with files or folders there: liệt kê/xem (list/browse), tạo/đổi tên/di chuyển/sao chép/xóa (create/rename/move/copy/delete) files & folders, tải lên (upload local files), tải về (download), tạo/gỡ link chia sẻ (share links), xem dung lượng trống/quota (free space), khôi phục bản cũ (restore an earlier version). Casual, terse, or unaccented phrasing still counts — just proceed, don't ask which storage they mean, and treat it as cloud storage rather than a local file task. This is INDIVIDUAL cloud storage, NOT a team site: send a team/group's "Shared Documents" or Files-tab documents to m365-sharepoint, Teams chat/channels to m365-teams, and Google Drive to gws-drive.
allowed-tools
["Bash","Read"]
m365-onedrive — Personal OneDrive Management
Prerequisites
which m365 || echo"Chưa cài m365 CLI. Chạy: npm i -g @pnp/cli-microsoft365"
m365 status || echo"Chưa đăng nhập. Chạy: m365 login"
For auth details, see ../m365-shared/references/authentication.md.
Operating Principles
OneDrive uses spo file/folder commands with OneDrive URL pattern: https://{tenant}-my.sharepoint.com/personal/{user_encoded}
Always resolve OneDrive URL first before any file operation
Output: always -o json with --query
Default document library folder: Documents
1. Discover — Find OneDrive URL
Auto-resolve Current User's OneDrive URL (non-admin)
KHÔNG construct URL bằng tay: tên tenant SharePoint thường KHÁC domain email (vd @miichisoft.com → host miichisoftjsc-my.sharepoint.com), nên ghép chuỗi bằng sed sẽ ra sai host. Hỏi thẳng Microsoft Graph để lấy webUrl chính xác:
# webUrl của OneDrive cá nhân (non-admin). Graph trả về ".../personal/<user>/Documents"
m365 request --url 'https://graph.microsoft.com/v1.0/me/drive?$select=webUrl' -o json --query 'webUrl'# ONEDRIVE_URL dùng cho các lệnh spo = site root (bỏ "/Documents" ở cuối):
ONEDRIVE_URL=$(m365 request --url 'https://graph.microsoft.com/v1.0/me/drive?$select=webUrl' -o json --query 'webUrl' | tr -d '"' | sed 's#/Documents$##')
# vd: https://miichisoftjsc-my.sharepoint.com/personal/tuanhv_miichisoft_com
# Confirm with user first! (option đúng là --url, KHÔNG phải --folderUrl)
m365 spo folder remove --webUrl "ONEDRIVE_URL" --url "Documents/Unwanted-Folder" --force