Export (0) Print
Expand All

New-InboxRule

Applies to: Exchange Server 2010

Topic Last Modified: 2011-03-19

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.


New-InboxRule -Name <String> [-ApplyCategory <MultiValuedProperty>] [-BodyContainsWords <MultiValuedProperty>] [-Confirm [<SwitchParameter>]] [-CopyToFolder <MailboxFolderIdParameter>] [-DeleteMessage <$true | $false>] [-DomainController <Fqdn>] [-ExceptIfBodyContainsWords <MultiValuedProperty>] [-ExceptIfFlaggedForAction <Any | Call | DoNotForward | FollowUp | ForYourInformation | Forward | NoResponseNecessary | Read | Reply | ReplyToAll | Review>] [-ExceptIfFrom <RecipientIdParameter[]>] [-ExceptIfFromAddressContainsWords <MultiValuedProperty>] [-ExceptIfFromSubscription <AggregationSubscriptionIdentity[]>] [-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 <Nullable>] [-ExceptIfWithinSizeRangeMinimum <Nullable>] [-ExceptIfWithSensitivity <Normal | Personal | Private | CompanyConfidential>] [-FlaggedForAction <Any | Call | DoNotForward | FollowUp | ForYourInformation | Forward | NoResponseNecessary | Read | Reply | ReplyToAll | Review>] [-Force <SwitchParameter>] [-ForwardAsAttachmentTo <RecipientIdParameter[]>] [-ForwardTo <RecipientIdParameter[]>] [-From <RecipientIdParameter[]>] [-FromAddressContainsWords <MultiValuedProperty>] [-FromSubscription <AggregationSubscriptionIdentity[]>] [-HasAttachment <$true | $false>] [-HasClassification <MessageClassificationIdParameter[]>] [-HeaderContainsWords <MultiValuedProperty>] [-Mailbox <MailboxIdParameter>] [-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>] [-WhatIf [<SwitchParameter>]] [-WithImportance <Low | Normal | High>] [-WithinSizeRangeMaximum <Nullable>] [-WithinSizeRangeMinimum <Nullable>] [-WithSensitivity <Normal | Personal | Private | CompanyConfidential>]


New-InboxRule -FromMessageId <MailboxStoreObjectIdParameter> -ValidateOnly <SwitchParameter> [-Confirm [<SwitchParameter>]] [-DomainController <Fqdn>] [-ExceptIfFromSubscription <AggregationSubscriptionIdentity[]>] [-Force <SwitchParameter>] [-FromSubscription <AggregationSubscriptionIdentity[]>] [-Mailbox <MailboxIdParameter>] [-WhatIf [<SwitchParameter>]]

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:

  • MailboxId\StoreObjectId
  • StoreObjectId

When you create an Inbox rule by specifying the FromMessageId parameter, the following properties of that message are used to create the rule:

  • Subject   The message subject is added to the SubjectContainsWords property of the rule.
  • From   The message sender is added to the From property of the rule.
  • To and Cc recipients   Recipients in the To and Cc fields of the message are added to the SentTo property of 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.

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 in the message body.

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 -Confirm:$False. You must include a colon ( : ) in 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 that the message be sent to the Deleted Items folder.

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 in the message body.

ExceptIfFlaggedForAction

Optional

Microsoft.Exchange.Data.Storage.RequestedAction

The ExceptIfFlaggedForAction parameter specifies one or more message flags to check the message for. You can use the following values:

  • Any
  • Call
  • DoNotForward
  • FollowUp
  • ForYourInfo
  • Forward
  • NoResponseNecessary
  • Read
  • Reply
  • ReplyToAll
  • Review

ExceptIfFrom

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptFrom parameter specifies a recipient to check in the From field of the message.

ExceptIfFromAddressContainsWords

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ExceptIfFromAddressContainsWords parameter specifies one or more words to check in the sender's address.

ExceptIfFromSubscription

Optional

Microsoft.Exchange.Data.ContentAggregation.AggregationSubscriptionIdentity[]

This parameter is available only in the Outlook Live service.

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. We recommend that you set the value to $true.

ExceptIfHasClassification

Optional

Microsoft.Exchange.Configuration.Tasks.MessageClassificationIdParameter[]

The ExceptIfHasClassification parameter checks messages for the specified message classification.

ExceptIfHeaderContainsWords

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ExceptIfHeaderContainsWords parameter specifies one or more words to check for in the specified message header.

ExceptIfMessageTypeMatches

Optional

Microsoft.Exchange.Data.Storage.InboxRuleMessageType

The ExceptIfMessageTypeMatches parameter specifies a message type. You can use the following values:

  • AutomaticReply
  • AutomaticForward
  • Encrypted
  • Calendaring
  • CalendaringResponse
  • PermissionControlled
  • Voicemail
  • Signed
  • ApprovalRequest
  • ReadReceipt
  • NonDeliveryReport

ExceptIfMyNameInCcBox

Optional

System.Boolean

The ExceptIfMyNameInCcBox parameter specifies that the Cc field of messages be checked for the mailbox owner's address.

ExceptIfMyNameInToBox

Optional

System.Boolean

The ExceptIfMyNameInToBox parameter specifies that the To field of messages be checked for the mailbox owner's address.

ExceptIfMyNameInToOrCcBox

Optional

System.Boolean

The ExceptIfMyNameInToOrCcBox parameter specifies that the To or Cc fields of messages be checked for the mailbox owner's address.

ExceptIfMyNameNotInToBox

Optional

System.Boolean

The ExceptIfMyNameNotInToBox parameter matches messages where the mailbox owner isn't addressed in the To field of the message.

ExceptIfReceivedAfterDate

Optional

Microsoft.Exchange.ExchangeSystem.ExDateTime

The ExceptIfReceivedAfterDate specifies a date.

ExceptIfReceivedBeforeDate

Optional

Microsoft.Exchange.ExchangeSystem.ExDateTime

The ExceptIfReceivedBeforeData parameter specifies a date.

ExceptIfRecipientAddressContainsWords

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ExceptIfRecipientAddressContainsWords parameter specifies one or more words to check in a recipient address.

ExceptIfSentOnlyToMe

Optional

System.Boolean

The ExceptIfSentOnlyToMe parameter checks for messages where the mailbox owner is the only recipient.

ExceptIfSentTo

Optional

Microsoft.Exchange.Configuration.Tasks.RecipientIdParameter[]

The ExceptIfSentTo parameter checks message recipients for the recipient specified.

ExceptIfSubjectContainsWords

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ExceptIfSubjectContainsWords parameter specifies one or more words or phrases to check in the message subject.

ExceptIfSubjectOrBodyContainsWords

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ExceptIfSubjectOrBodyContainsWords parameter specifies one or more words or phrases to check in the message subject or body.

ExceptIfWithImportance

Optional

Microsoft.Exchange.Data.Storage.Importance

The ExceptIfWithImportance parameter specifies a message importance level. Valid values include one of the following:

  • Low
  • Normal
  • High

ExceptIfWithinSizeRangeMaximum

Optional

System.Nullable

The ExceptIfWithinSizeRangeMaximum parameter specifies the maximum message size. When using this parameter, you must also specify a minimum message size value using the ExceptIfWithinSizeRangeMinimum parameter.

ExceptIfWithinSizeRangeMinimum

Optional

System.Nullable

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.

ExceptIfWithSensitivity

Optional

Microsoft.Exchange.Data.Storage.Sensitivity

The ExceptIfWithSensitivity parameter specifies a message sensitivity level. You can use the following values:

  • Normal
  • Personal
  • Private
  • CompanyConfidential

FlaggedForAction

Optional

Microsoft.Exchange.Data.Storage.RequestedAction

The FlaggedForAction parameter specifies one or more message flags to check the message for. You can use the following values:

  • Any
  • Call
  • DoNotForward
  • FollowUp
  • ForYourInfo
  • Forward
  • NoResponseNecessary
  • Read
  • Reply
  • ReplyToAll
  • Review

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 2010, 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 action specifies the identity of 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.Data.ContentAggregation.AggregationSubscriptionIdentity[]

This parameter is available only in the Outlook Live service.

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 checks for messages with an attachment.

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:

  • GUID
  • Distinguished name (DN)
  • Domain\Account
  • User principal name (UPN)
  • LegacyExchangeDN
  • SmtpAddress
  • Alias

MarkAsRead

Optional

System.Boolean

The MarkAsRead parameter specifies whether to mark the message as read. When set to $true, the MarkAsRead parameter marks the message as read.

MarkImportance

Optional

Microsoft.Exchange.Data.Storage.Importance

The MarkImportance parameter specifies that the message importance be marked with one of the following values:

  • Low
  • Normal
  • High

MessageTypeMatches

Optional

Microsoft.Exchange.Data.Storage.InboxRuleMessageType

The MessageTypeMatches parameter specifies a message type. You can use the following values:

  • AutomaticReply
  • AutomaticForward
  • Encrypted
  • Calendaring
  • CalendaringResponse
  • PermissionControlled
  • Voicemail
  • Signed
  • ApprovalRequest
  • ReadReceipt
  • NonDeliveryReport

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 checks for the mailbox owner's name in the Cc field. We recommend that you set the value to $true to use this predicate.

MyNameInToBox

Optional

System.Boolean

The MyNameInToBox parameter checks for the mailbox owner's name in the To field. We recommend that you set the value to $true to use this predicate.

MyNameInToOrCcBox

Optional

System.Boolean

The MyNameInToOrCcBox specifies that the mailbox for which the rule is being created should appear in the To or Cc fields of the message. We recommend that you set the value to $true to add this condition.

MyNameNotInToBox

Optional

System.Boolean

The MyNameNotInToBox parameter checks the mailbox owner's name in the To box. We recommend that you set the value to $true to use this predicate.

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.

ReceivedBeforeDate

Optional

Microsoft.Exchange.ExchangeSystem.ExDateTime

The ReceivedBeforeDate parameter specifies a date. The rule is applied only to messages received before the specified date.

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:

  • $true
  • $false

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 keywords 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:

  • High
  • Normal
  • Low

WithinSizeRangeMaximum

Optional

System.Nullable

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

System.Nullable

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:

  • Normal
  • Personal
  • Private
  • CompanyConfidential

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.

Dd335170.important(en-us,EXCHG.140).gifImportant:
When you create, modify, remove, enable, or disable an Inbox rule on Microsoft Exchange Server 2010, 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 Mailbox Permissions topic.

Error Description

 

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.

New-InboxRule "CheckActionRequired" -MyNameInToBox $true -FlaggedForAction Any -MarkImportanceHigh
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft