Skip to content

New command: m365 outlook mail searchfolder add #6276

@MartinM85

Description

@MartinM85

Usage

m365 outlook mail searchfolder add [options]

Description

Creates a new mail search folder in the user's mailbox

Options

Option Description
-i, --userId [userId] The id of the user in whose mailbox the search folder should be created. Specify either userId or userName, but not both.
-n, --userName [userName] The UPN of the user in whose mailbox the search folder should be created. Specify either userId or userName, but not both.
--folderName <folderName> The name of the mail search folder.
--sourceFolderIds <sourceFolderIds> Comma-separated list of mail folders that should be searched.
--includeNestedFolders The nested mail folders will be searched if specified.
--messageFilter <messageFilter> The OData query to filter the messages.

Examples

Create a mail search folder in the user's mailbox specified by id for messages from the inbox that contain specific subject

m365 outlook mail searchfolder add --userId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --folderName 'CLI m365' --sourceFolderIds 'AQMkADYAAAIBDAAAAA==' --messageFilter "contains(subject, 'CLI for Microsoft 365')"

Create a mail search folder in the user's mailbox specified by UPN for incoming and outgoing messages from a specific year that contain specific text in a message body, search for messages inside all subfolders

m365 outlook mail searchfolder add --userName john.doe@contoso.com --folderName 'Power Platform Community' --sourceFolderIds 'AQMkADYAAAIBDAAAAA==,AQMkADYAAAIBDBBBBB==' --includeNestedFolders --messageFilter "contains(body/content,'Power Platform') AND receivedDateTime ge 2024-01-01 AND receivedDateTime le 2024-12-31"

Additional Info

The command requires Mail.ReadWrite permission.

More info: https://learn.microsoft.com/graph/api/mailsearchfolder-post?view=graph-rest-1.0&tabs=http

I will work on it

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions