commands.md

  1# Command Reference
  2
  3Full flag documentation for every exo-teams command.
  4
  5## auth
  6
  7```
  8exo-teams auth [--import] [--refresh]
  9```
 10
 11- No flags: device code OAuth login (opens browser)
 12- `--import`: import tokens from fossteams (`~/.config/fossteams/`)
 13- `--refresh`: force refresh using saved refresh token
 14
 15## whoami
 16
 17```
 18exo-teams whoami [--json]
 19```
 20
 21Shows display name, email, and expiry for all 5 tokens. JSON output is an array of `{name, valid, expiry}`.
 22
 23## list-teams
 24
 25```
 26exo-teams list-teams [--json]
 27```
 28
 29Lists all teams with their channels. Output format:
 30```
 31== Team Name ==
 32   Description
 33   #channel-name                   19:channelid@thread.tacv2 (general)
 34```
 35
 36The channel ID is what you pass to `get-messages`.
 37
 38## list-chats
 39
 40```
 41exo-teams list-chats [--json]
 42```
 43
 44Lists DMs and group chats. Resolves MRI UUIDs to display names via Graph API.
 45```
 46* [DM   ] Person Name                       19:chatid@unq.gbl.spaces
 47           Person: last message preview
 48```
 49
 50`*` prefix means unread. The chat ID is what you pass to `get-chat`, `send`, `send-file`, `mark-read`.
 51
 52## get-messages
 53
 54```
 55exo-teams get-messages <search> [--count N] [--all] [--replies] [--since DATE] [--json]
 56```
 57
 58- `<search>`: matches against "TeamName ChannelName" (case-insensitive), or exact channel ID
 59- `--count N`: messages per page (default 200)
 60- `--all`: follow backwardLink pagination to get all messages
 61- `--replies`: show reply threads grouped and indented
 62- `--since DATE`: filter to messages on/after date, format `2026-03-15`
 63
 64Output (oldest first):
 65```
 66[2026-03-20 14:22] Alice: message content
 67  > [2026-03-20 14:25] Bob: reply content  (with --replies)
 68```
 69
 70## get-chat
 71
 72```
 73exo-teams get-chat <search> [--count N] [--all] [--replies] [--since DATE] [--json]
 74```
 75
 76- `<search>`: matches against title, member name, chat ID, or last message content
 77- Same flags as `get-messages`
 78
 79## send
 80
 81```
 82exo-teams send <conversation-id> <message>
 83```
 84
 85Sends a plain text message. Works for both channel IDs and chat IDs.
 86
 87## send-file
 88
 89```
 90exo-teams send-file <conversation-id> --file <path> [--file <path>...] [--message <text>]
 91```
 92
 93- `--file`: local file path (repeat for multiple files)
 94- `--message`: optional text with the first file
 95
 96**How it works**: uploads to OneDrive `/me/drive/root:/Microsoft Teams Chat Files/<name>:/content`, creates an org-scoped share link, then sends a message with the file metadata. Retries up to 5 times on 423 (locked) with deduplicated names.
 97
 98## new-dm
 99
100```
101exo-teams new-dm <user-search> <message>
102```
103
104Searches tenant users via Graph `$filter=startswith(displayName,'...')`, creates a 1:1 conversation, sends the message. Prints found user name/email to stderr.
105
106## files
107
108```
109exo-teams files <team-search> [--path <subfolder>] [--drive <drive-name>] [--all-drives] [--json]
110```
111
112- `<team-search>`: partial team name match
113- `--path`: subfolder within drive (e.g. `General` or `General/Week 1`)
114- `--drive`: specific drive by name (e.g. `Class Materials`)
115- `--all-drives`: list files from ALL drives (Documents, Class Materials, etc.)
116
117Education teams typically have two drives: `Documents` (default) and `Class Materials`.
118
119Output:
120```
121F filename.pdf                          1234 KB  2026-03-20 14:22  Alice
122D Subfolder                             3 items  2026-03-15 10:00  Bob
123```
124
125## upload
126
127```
128exo-teams upload <team-search> --path <remote-path> --file <local-file>
129```
130
131- `--path`: remote path in team drive (e.g. `General/report.pdf`)
132- `--file`: local file to upload
133
134Uses Graph PUT to `/groups/{groupId}/drive/root:/{path}:/content`.
135
136## download
137
138```
139exo-teams download <team-search> --path <file-path> [--output <dir-or-file>] [--drive <drive-name>]
140```
141
142- `--path`: file path in team drive (e.g. `General/Cat Cafe (1).xlsx`)
143- `--output`: local output directory or full file path (default: current directory)
144- `--drive`: target a specific drive by name
145
146## calendar
147
148```
149exo-teams calendar [--days N] [--json]
150```
151
152- `--days N`: days ahead to show (default 7)
153
154Shows subject, time range, location, organizer, and body preview. Skips cancelled events.
155
156## assignments
157
158```
159exo-teams assignments [--classes] [--json]
160```
161
162- `--classes`: list education classes with IDs instead of assignments
163
164Default output shows all assignments across all classes with submission status:
165```
166[ ] Assignment Name               due: 2026-03-25 23:59  class: Academic Writing
167    Instructions preview...
168[ ] uncompleted
169[~] in progress / working
170[x] submitted
171[>] returned (graded)
172```
173
174Submitted files are listed with their names and links.
175
176## submit
177
178```
179exo-teams submit <class-search> <assignment-search> --file <path>
180```
181
1821. Finds class by partial name match
1832. Finds assignment by partial name match
1843. Gets your submission ID
1854. Calls SetUpResourcesFolder
1865. Uploads file as a submission resource
1876. Calls submit endpoint
188
189## deadlines
190
191```
192exo-teams deadlines [--json]
193```
194
195Shows only non-submitted assignments, sorted by due date. Calculates days remaining. Shows OVERDUE, TODAY, TOMORROW labels.
196
197## unread
198
199```
200exo-teams unread [--json]
201```
202
203Filters chats where `isRead == false`. Shows title, last sender, and last message preview.
204
205## activity
206
207```
208exo-teams activity [--json]
209```
210
211Reads from the `48:notifications` special conversation thread. Shows activityType (mention, reply, reaction), sender, and content.
212
213## search
214
215```
216exo-teams search <query> [--json]
217```
218
219Searches using Graph `/search/query` with `message` and `driveItem` entity types. Returns up to 25 hits. Shows sender, timestamp, channel/location, and content preview.
220
221## mark-read
222
223```
224exo-teams mark-read <conversation-id>
225```
226
227Sets consumptionHorizon to current timestamp via PUT to internal API.