Applies to: Exchange Server 2013, Exchange Online
Topic Last Modified: 2012-09-18
Use the New-InboxRule cmdlet to create an Inbox rule for a mailbox. Inbox rules are used to process messages in the Inbox based on conditions specified and take actions such as moving a message to a specified folder or deleting a message.
You must have adequate permissions on the mailbox to create an Inbox rule.
For information about the parameter sets in the Syntax section below, see Syntax.
Syntax
New-InboxRule -Name <String> [-ApplyCategory
<MultiValuedProperty>] [-BodyContainsWords
<MultiValuedProperty>] [-CopyToFolder
<MailboxFolderIdParameter>] [-DeleteMessage <$true |
$false>] [-ExceptIfBodyContainsWords
<MultiValuedProperty>] [-ExceptIfFlaggedForAction
<String>] [-ExceptIfFrom <RecipientIdParameter[]>]
[-ExceptIfFromAddressContainsWords <MultiValuedProperty>]
[-ExceptIfHasAttachment <$true | $false>]
[-ExceptIfHasClassification
<MessageClassificationIdParameter[]>]
[-ExceptIfHeaderContainsWords <MultiValuedProperty>]
[-ExceptIfMessageTypeMatches <AutomaticReply | AutomaticForward
| Encrypted | Calendaring | CalendaringResponse |
PermissionControlled | Voicemail | Signed | ApprovalRequest |
ReadReceipt | NonDeliveryReport>] [-ExceptIfMyNameInCcBox
<$true | $false>] [-ExceptIfMyNameInToBox <$true |
$false>] [-ExceptIfMyNameInToOrCcBox <$true | $false>]
[-ExceptIfMyNameNotInToBox <$true | $false>]
[-ExceptIfReceivedAfterDate <ExDateTime>]
[-ExceptIfReceivedBeforeDate <ExDateTime>]
[-ExceptIfRecipientAddressContainsWords
<MultiValuedProperty>] [-ExceptIfSentOnlyToMe <$true |
$false>] [-ExceptIfSentTo <RecipientIdParameter[]>]
[-ExceptIfSubjectContainsWords <MultiValuedProperty>]
[-ExceptIfSubjectOrBodyContainsWords <MultiValuedProperty>]
[-ExceptIfWithImportance <Low | Normal | High>]
[-ExceptIfWithinSizeRangeMaximum <ByteQuantifiedSize>]
[-ExceptIfWithinSizeRangeMinimum <ByteQuantifiedSize>]
[-ExceptIfWithSensitivity <Normal | Personal | Private |
CompanyConfidential>] [-FlaggedForAction <String>]
[-ForwardAsAttachmentTo <RecipientIdParameter[]>] [-ForwardTo
<RecipientIdParameter[]>] [-From
<RecipientIdParameter[]>] [-FromAddressContainsWords
<MultiValuedProperty>] [-HasAttachment <$true |
$false>] [-HasClassification
<MessageClassificationIdParameter[]>] [-HeaderContainsWords
<MultiValuedProperty>] [-MarkAsRead <$true | $false>]
[-MarkImportance <Low | Normal | High>] [-MessageTypeMatches
<AutomaticReply | AutomaticForward | Encrypted | Calendaring |
CalendaringResponse | PermissionControlled | Voicemail | Signed |
ApprovalRequest | ReadReceipt | NonDeliveryReport>]
[-MoveToFolder <MailboxFolderIdParameter>] [-MyNameInCcBox
<$true | $false>] [-MyNameInToBox <$true | $false>]
[-MyNameInToOrCcBox <$true | $false>] [-MyNameNotInToBox
<$true | $false>] [-Priority <Int32>]
[-ReceivedAfterDate <ExDateTime>] [-ReceivedBeforeDate
<ExDateTime>] [-RecipientAddressContainsWords
<MultiValuedProperty>] [-RedirectTo
<RecipientIdParameter[]>] [-SendTextMessageNotificationTo
<MultiValuedProperty>] [-SentOnlyToMe <$true | $false>]
[-SentTo <RecipientIdParameter[]>] [-StopProcessingRules
<$true | $false>] [-SubjectContainsWords
<MultiValuedProperty>] [-SubjectOrBodyContainsWords
<MultiValuedProperty>] [-WithImportance <Low | Normal |
High>] [-WithinSizeRangeMaximum <ByteQuantifiedSize>]
[-WithinSizeRangeMinimum <ByteQuantifiedSize>]
[-WithSensitivity <Normal | Personal | Private |
CompanyConfidential>] <COMMON PARAMETERS>
|
New-InboxRule -FromMessageId
<MailboxStoreObjectIdParameter> -ValidateOnly
<SwitchParameter> <COMMON PARAMETERS>
|
COMMON PARAMETERS: [-AlwaysDeleteOutlookRulesBlob
<SwitchParameter>] [-Confirm [<SwitchParameter>]]
[-DomainController <Fqdn>] [-ExceptIfFromSubscription
<AggregationSubscriptionIdentity[]>] [-Force
<SwitchParameter>] [-FromSubscription
<AggregationSubscriptionIdentity[]>] [-Mailbox
<MailboxIdParameter>] [-Organization
<OrganizationIdParameter>] [-WhatIf
[<SwitchParameter>]]
|
Examples
EXAMPLE 1
This example raises the message importance to
High
if the mailbox owner is in the To field. In
addition, the message is flagged for action.
Copy Code | |
---|---|
New-InboxRule "CheckActionRequired" -MyNameInToBox $true -FlaggedForAction Any -MarkImportance "High" |
Detailed Description
The New-InboxRule cmdlet exposes rule predicates and actions, in addition to the parameters such as a rule name and the mailbox identity, required to create an Inbox rule.
Important: |
---|
When you create, modify, remove, enable, or disable an Inbox rule on Microsoft Exchange Server 2013, any client-side rules created by Microsoft Outlook are removed. |
Predicate parameters used for conditions, such as SubjectOrBodyContainsWords, also have an exception parameter. When conditions specified in an exception are matched, the rule isn't applied to the message. Exception parameters begin with ExceptIf. For example, the exception parameter for SubjectOrBodyContainsWords is ExceptIfSubjectOrBodyContainsWords.
You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Inbox rules" entry in the Recipients Permissions topic.
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
FromMessageId |
Required |
Microsoft.Exchange.Configuration.Tasks.MailboxStoreObjectIdParameter |
The FromMessageId parameter specifies a message ID to create an Inbox rule based on the properties of that message. You must specify the Base64-encoded StoreObjectId of the message. Valid values include one of the following:
When you create an Inbox rule by specifying the FromMessageId parameter, the following properties of that message are used to create the rule:
|
Name |
Required |
System.String |
The Name parameter specifies a name for the Inbox rule being created. |
ValidateOnly |
Required |
System.Management.Automation.SwitchParameter |
The ValidateOnly switch tells the cmdlet to evaluate the conditions and requirements necessary to perform the operation and then reports whether the operation will succeed or fail. No changes are made when the ValidateOnly switch is used. |
AlwaysDeleteOutlookRulesBlob |
Optional |
System.Management.Automation.SwitchParameter |
The AlwaysDeleteOutlookRulesBlob parameter suppresses a warning that end users or administrators get if they use Outlook Web App or Windows PowerShell to modify Inbox rules. |
ApplyCategory |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ApplyCategory parameter specifies one or more categories to apply to a message. |
BodyContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The BodyContainsWords parameter specifies one or more words or phrases to check the message body for. If phrases contain a space, you must enclose it in quotation marks ("). Use a comma to separate phrases. |
Confirm |
Optional |
System.Management.Automation.SwitchParameter |
The Confirm switch can be used to suppress the
confirmation prompt that appears by default when this cmdlet is
run. To suppress the confirmation prompt, use the syntax
|
CopyToFolder |
Optional |
Microsoft.Exchange.Configuration.Tasks.MailboxFolderIdParameter |
The CopyToFolder parameter specifies the name of an existing mailbox folder to copy the message to. |
DeleteMessage |
Optional |
System.Boolean |
The DeleteMessage parameter specifies whether the message
is sent to the Deleted Items folder. If set to |
DomainController |
Optional |
Microsoft.Exchange.Data.Fqdn |
The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory. |
ExceptIfBodyContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfBodyContainsWords parameter specifies one or more words or phrases to check the message body for. If the message body contains the specified words or phrases, the Inbox rule action isn't applied. |
ExceptIfFlaggedForAction |
Optional |
System.String |
The ExceptIfFlaggedForAction parameter specifies one or more message flags for which to check. You can use the following values:
If the requested action in the message matches the requested action specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfFrom |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The ExceptIfFrom parameter specifies a recipient to check in the From field of the message. If the message sender matches the senders specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfFromAddressContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfFromAddressContainsWords parameter specifies one or more words to check in the sender's address. If the sender's address contains the specified words, the Inbox rule action isn't applied to the message. |
ExceptIfFromSubscription |
Optional |
Microsoft.Exchange.Transport.Sync.Common.Subscription.AggregationSubscriptionIdentity[] |
This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments. The ExceptIfFromSubscription parameter specifies an exception when a message is received from a POP, IMAP, or Hotmail subscription. |
ExceptIfHasAttachment |
Optional |
System.Boolean |
The ExceptIfHasAttachment parameter specifies whether the
rule should apply to messages with attachments. Valid values
include If the ExceptIfHasAttachment parameter is set to
|
ExceptIfHasClassification |
Optional |
Microsoft.Exchange.Configuration.Tasks.MessageClassificationIdParameter[] |
The ExceptIfHasClassification parameter checks the message for the specified classification name. Use the Get-MessageClassification cmdlet to retrieve a list of classifications defined in the organization. If the message classification matches the classification specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfHeaderContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfHeaderContainsWords parameter specifies one or more words to check for in the specified message header. If the message header contains the words specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfMessageTypeMatches |
Optional |
Microsoft.Exchange.Data.Storage.InboxRuleMessageType |
The ExceptIfMessageTypeMatches parameter specifies a message type. You can use the following values:
If the message type equals one of the preceding values, the Inbox rule action isn't applied. |
ExceptIfMyNameInCcBox |
Optional |
System.Boolean |
The ExceptIfMyNameInCcBox parameter specifies that the Cc field of messages be checked for the mailbox owner's address. This parameter accepts If the name of the recipient whose Inbox is being edited is in the Cc box, the Inbox rule action isn't applied. |
ExceptIfMyNameInToBox |
Optional |
System.Boolean |
The ExceptIfMyNameInToBox parameter specifies that the To field of messages be checked for the mailbox owner's address. If the name of the recipient whose Inbox is being edited is in the To box, the Inbox rule action isn't applied. This parameter accepts |
ExceptIfMyNameInToOrCcBox |
Optional |
System.Boolean |
The ExceptIfMyNameInToOrCcBox parameter specifies that the To or Cc fields of messages be checked for the mailbox owner's address. If the name of the recipient whose Inbox is being edited is in the To or Cc box, the Inbox rule action isn't applied. This parameter accepts |
ExceptIfMyNameNotInToBox |
Optional |
System.Boolean |
The ExceptIfMyNameNotInToBox parameter matches messages where the mailbox owner isn't addressed in the To field of the message. If the name of the recipient whose Inbox is being edited is not in the To box, the Inbox rule action isn't applied. This parameter accepts |
ExceptIfReceivedAfterDate |
Optional |
Microsoft.Exchange.ExchangeSystem.ExDateTime |
The ExceptIfReceivedAfterDate parameter specifies to check for messages received after the specified date. Use the short date format defined in the Regional Options settings for the computer on which the command is run. For example, if the computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2010 to specify March 1, 2010. You can enter the date only, or you can enter the date and time of day. If you enter the date and time of day, you must enclose the argument in quotation marks ("), for example, "10/05/2010 5:00 PM". If the message was received after the date specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfReceivedBeforeDate |
Optional |
Microsoft.Exchange.ExchangeSystem.ExDateTime |
The ExceptIfReceivedBeforeDate parameter specifies to check for messages received before the specified date. Use the short date format defined in the Regional Options settings for the computer on which the command is run. For example, if the computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2010 to specify March 1, 2010. You can enter the date only, or you can enter the date and time of day. If you enter the date and time of day, you must enclose the argument in quotation marks ("), for example, "10/05/2010 5:00 PM". If the message was received before the time specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfRecipientAddressContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfRecipientAddressContainsWords parameter specifies one or more words to check in the message recipient's address. If the recipient address contains one or more words specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfSentOnlyToMe |
Optional |
System.Boolean |
The ExceptIfSentOnlyToMe parameter specifies to check for messages where the mailbox owner is the only recipient. This parameter accepts If the message is only sent to the recipient whose Inbox rule is being edited, the Inbox rule action isn't applied. |
ExceptIfSentTo |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The ExceptIfSentTo parameter specifies to check message recipients for the recipient specified. If the message was sent to the recipient specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfSubjectContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfSubjectContainsWords parameter specifies one or more words or phrases to check in the message subject. If the message subject contains one or more words or phrases specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfSubjectOrBodyContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The ExceptIfSubjectOrBodyContainsWords parameter specifies one or more words or phrases to check in the message subject or body. If the message subject or body contains one or more of the words or phrases specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfWithImportance |
Optional |
Microsoft.Exchange.Data.Storage.Importance |
The ExceptIfWithImportance parameter specifies a message importance level. Valid values include one of the following:
If the message importance matches the importance specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfWithinSizeRangeMaximum |
Optional |
Microsoft.Exchange.Data.ByteQuantifiedSize |
The ExceptIfWithinSizeRangeMaximum parameter specifies the maximum message size. When using this parameter, you must also specify the minimum message size value using the ExceptIfWithinSizeRangeMinimum parameter. If the message size exceeds the maximum value specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfWithinSizeRangeMinimum |
Optional |
Microsoft.Exchange.Data.ByteQuantifiedSize |
The ExceptIfWithinSizeRangeMinimum parameter specifies the minimum message size. When using this parameter, you must also specify a maximum message size value using the ExceptIfWithinSizeRangeMaximum parameter. If the message size is smaller than the minimum value specified in this parameter, the Inbox rule action isn't applied. |
ExceptIfWithSensitivity |
Optional |
Microsoft.Exchange.Data.Storage.Sensitivity |
The ExceptIfWithSensitivity parameter specifies a message sensitivity level. You can use the following values:
If the sensitivity matches the sensitivity value specified in this parameter, the Inbox rule action isn't applied. |
FlaggedForAction |
Optional |
System.String |
The FlaggedForAction parameter specifies one or more message flags for which to check. Values include:
|
Force |
Optional |
System.Management.Automation.SwitchParameter |
The Force switch specifies whether the command suppresses the confirmation prompt produced if rules created by Microsoft Outlook exist on the mailbox. When taking an action using Inbox rules on Exchange 2013, any client-side rules are removed. |
ForwardAsAttachmentTo |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The ForwardAsAttachmentTo parameter specifies a recipient to forward the message to as an attachment. |
ForwardTo |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The ForwardTo parameter specifies a recipient to forward the message to. |
From |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The From parameter specifies the identity of the sender as a rule condition. |
FromAddressContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The FromAddressContainsWords parameter specifies one or more words to check in the From field of the message. |
FromSubscription |
Optional |
Microsoft.Exchange.Transport.Sync.Common.Subscription.AggregationSubscriptionIdentity[] |
This parameter applies to objects in the cloud-based service. It isn’t available for on-premises deployments. The FromSubscription parameter specifies the condition when a message is received from a POP, IMAP, or Hotmail subscription. |
HasAttachment |
Optional |
System.Boolean |
The HasAttachment parameter specifies whether to check for messages with attachments. |
HasClassification |
Optional |
Microsoft.Exchange.Configuration.Tasks.MessageClassificationIdParameter[] |
The HasClassification parameter checks messages for the specified message classification. |
HeaderContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The HeaderContainsWords parameter specifies one or more words to match in the specified message header. |
Mailbox |
Optional |
Microsoft.Exchange.Configuration.Tasks.MailboxIdParameter |
The Mailbox parameter specifies the identity of the mailbox for which the rule is being created. The following values can be used:
|
MarkAsRead |
Optional |
System.Boolean |
The MarkAsRead parameter specifies whether to mark the
message as read. When set to |
MarkImportance |
Optional |
Microsoft.Exchange.Data.Storage.Importance |
The MarkImportance parameter specifies that the message importance be marked with one of the following values:
|
MessageTypeMatches |
Optional |
Microsoft.Exchange.Data.Storage.InboxRuleMessageType |
The MessageTypeMatches parameter specifies a message type. You can use the following values:
|
MoveToFolder |
Optional |
Microsoft.Exchange.Configuration.Tasks.MailboxFolderIdParameter |
The MoveToFolder parameter specifies an existing mailbox folder to which the message is copied. |
MyNameInCcBox |
Optional |
System.Boolean |
The MyNameInCcBox parameter specifies that the mailbox
for which the rule is being created should appear in the Cc field
of the message. To use this predicate, set the value to
|
MyNameInToBox |
Optional |
System.Boolean |
The MyNameInToBox parameter specifies that the mailbox
for which the rule is being created should appear in the To field
of the message. To use this predicate, set the value to
|
MyNameInToOrCcBox |
Optional |
System.Boolean |
The MyNameInToOrCcBox parameter specifies that the
mailbox for which the rule is being created should appear in the To
or Cc fields of the message. To add this condition, set the value
to |
MyNameNotInToBox |
Optional |
System.Boolean |
The MyNameNotInToBox parameter checks that the mailbox
owner's name isn't in the To box. We recommend that you set the
value to |
Organization |
Optional |
Microsoft.Exchange.Configuration.Tasks.OrganizationIdParameter |
This parameter is reserved for internal Microsoft use. |
Priority |
Optional |
System.Int32 |
The Priority parameter sets a priority for the Inbox rule. |
ReceivedAfterDate |
Optional |
Microsoft.Exchange.ExchangeSystem.ExDateTime |
The ReceivedAfterDate parameter specifies a date. The rule is applied to messages received after the specified date. Use the short date format defined in the Regional Options settings for the computer on which the command is run. For example, if the computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2010 to specify March 1, 2010. You can enter the date only, or you can enter the date and time of day. If you enter the date and time of day, you must enclose the argument in quotation marks ("), for example, "10/05/2010 5:00 PM". |
ReceivedBeforeDate |
Optional |
Microsoft.Exchange.ExchangeSystem.ExDateTime |
The ReceivedBeforeDate parameter specifies a date. The rule is applied only to messages received before the specified date. Use the short date format defined in the Regional Options settings for the computer on which the command is run. For example, if the computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2010 to specify March 1, 2010. You can enter the date only, or you can enter the date and time of day. If you enter the date and time of day, you must enclose the argument in quotation marks ("), for example, "10/05/2010 5:00 PM". |
RecipientAddressContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The RecipientAddressContainsWords parameter specifies one or more words to check for in a recipient address. |
RedirectTo |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The RedirectTo parameter specifies a recipient to redirect the message to. |
SendTextMessageNotificationTo |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The SendTextMessageNotificationTo parameter specifies one or more text message recipients to send a notification to. |
SentOnlyToMe |
Optional |
System.Boolean |
The SentOnlyToMe parameter specifies whether the mailbox owner is specified as the only recipient. You can use the following values:
|
SentTo |
Optional |
Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[] |
The SentTo parameter specifies the identity of a recipient as a condition. |
StopProcessingRules |
Optional |
System.Boolean |
The StopProcessingRules parameter specifies that Exchange stop processing additional rules if the conditions of this Inbox rule are met. |
SubjectContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The SubjectContainsWords parameter specifies one or more keywords to be matched in the subject field of a message. |
SubjectOrBodyContainsWords |
Optional |
Microsoft.Exchange.Data.MultiValuedProperty |
The SubjectOrBodyContainsWords parameter specifies one or more words to be matched in the message subject or body. |
WhatIf |
Optional |
System.Management.Automation.SwitchParameter |
The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch. |
WithImportance |
Optional |
Microsoft.Exchange.Data.Storage.Importance |
The WithImportance parameter checks messages with the specified importance level. You can use the following values:
|
WithinSizeRangeMaximum |
Optional |
Microsoft.Exchange.Data.ByteQuantifiedSize |
The WithinSizeRangeMaximum parameter specifies the maximum message size. When using this parameter, you must also specify a minimum message size value using the WithinSizeRangeMinimum parameter. |
WithinSizeRangeMinimum |
Optional |
Microsoft.Exchange.Data.ByteQuantifiedSize |
The WithinSizeRangeMinimum parameter specifies the minimum message size. When using this parameter, you must also specify a maximum message size value using the WithinSizeRangeMaximum parameter. |
WithSensitivity |
Optional |
Microsoft.Exchange.Data.Storage.Sensitivity |
The WithSensitivity parameter specifies a message sensitivity level. Valid values include one of the following:
|
Input Types
To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.
Return Types
To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.