Operação UpdateInboxRulesUpdateInboxRules operation

A operação UpdateInboxRules atualiza as regras de caixa de entrada do usuário autenticado aplicando as operações especificadas.The UpdateInboxRules operation updates the authenticated user's Inbox rules by applying the specified operations. UpdateInboxRules é usado para criar uma regra de caixa de entrada, para definir uma regra de caixa de entrada, ou para excluir uma regra de caixa de entrada.UpdateInboxRules is used to create an Inbox rule, to set an Inbox rule, or to delete an Inbox rule.

Quando você usa a operação UpdateInboxRules , os serviços Web do Exchange excluem as regras de envio do lado do cliente.When you use the UpdateInboxRules operation, Exchange Web Services deletes client-side send rules. As regras de envio do lado do cliente são armazenadas no cliente na mensagem de FAI (informações associadas à pasta de regras) e em outro lugar.Client-side send rules are stored on the client in the rule Folder Associated Information (FAI) Message and nowhere else. O EWS exclui essa regra FAI mensagem por padrão, com base na expectativa de que o Outlook a recriará.EWS deletes this rule FAI message by default, based on the expectation that Outlook will recreate it. No entanto, o Outlook não pode recriar regras que não existam também como uma regra estendida e as regras de envio do lado do cliente não existem como regras estendidas.However, Outlook can't recreate rules that don't also exist as an extended rule, and client-side send rules don't exist as extended rules. Como resultado, essas regras são perdidas.As a result, these rules are lost. Sugerimos que você considere isso ao criar sua solução.We suggest you consider this when designing your solution.

Exemplo de solicitação UpdateInboxRules (criar regra)UpdateInboxRules (Create Rule) request example

Você pode usar os serviços Web do Exchange para criar uma regra de caixa de entrada na caixa de correio de um usuário no repositório do Exchange.You can use Exchange Web Services to create an Inbox rule in a user's mailbox in the Exchange store. Use o elemento UpdateInboxRules em conjunto com o elemento CreateRuleOperation para criar uma regra.Use the UpdateInboxRules element in conjunction with the CreateRuleOperation element to create a rule.

DescriçãoDescription

O cliente cria a solicitação XML e a envia para o servidor.The client constructs the request XML and sends it to the server.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version ="Exchange2010_SP1"/>
  </soap:Header>
  <soap:Body>
      <m:UpdateInboxRules>
        <m:RemoveOutlookRuleBlob>true</m:RemoveOutlookRuleBlob>
        <m:Operations>
          <t:CreateRuleOperation>
            <t:Rule>
              <t:DisplayName>MoveInterestingToJunk</t:DisplayName>
              <t:Priority>1</t:Priority>
              <t:IsEnabled>true</t:IsEnabled>
              <t:Conditions>
                <t:ContainsSubjectStrings>
                  <t:String>Interesting</t:String>
                </t:ContainsSubjectStrings>
              </t:Conditions>
              <t:Exceptions />
              <t:Actions>
                <t:MoveToFolder>
                  <t:DistinguishedFolderId Id="junkemail" />
                </t:MoveToFolder>
              </t:Actions>
            </t:Rule>
          </t:CreateRuleOperation>
        </m:Operations>
      </m:UpdateInboxRules>
  </soap:Body>
</soap:Envelope>

ComentáriosComments

Este exemplo cria uma regra que moverá uma mensagem de email para a pasta lixo eletrônico, se o assunto do email contiver uma cadeia de caracteres igual a "interessante".This example builds a rule that will move an e-mail message to the Junk E-mail folder if the e-mail subject contains a string that equals "Interesting".

Elementos RequestRequest elements

A solicitação UpdateInboxRules inclui os seguintes elementos:The UpdateInboxRules request includes the following elements:

O elemento Operations contém o elemento CreateRuleOperation para criar uma regra.The Operations element contains the CreateRuleOperation element to create a rule.

Exemplo de resposta UpdateInboxRules (Create Rule)UpdateInboxRules (Create Rule) response example

DescriçãoDescription

O exemplo a seguir do corpo SOAP (Simple Object Access Protocol) mostra uma resposta bem-sucedida à solicitação UpdateInboxRules que cria uma regra.The following Simple Object Access Protocol (SOAP) body example shows a successful response to the UpdateInboxRules request that creates a rule.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="14" 
        MinorVersion="1" 
        MajorBuildNumber="139" 
        MinorBuildNumber="0" Version="Exchange2010_SP1" 
        xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <UpdateInboxRulesResponse 
         ResponseClass="Success" xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseCode>NoError</ResponseCode>
    </UpdateInboxRulesResponse>
  </s:Body>
</s:Envelope>

Elementos de resposta bem-sucedidosSuccessful response elements

Os seguintes elementos são usados na resposta:The following elements are used in the response:

Exemplo de solicitação UpdateInboxRules (set rule)UpdateInboxRules (Set Rule) request example

Você pode usar os serviços Web do Exchange para modificar uma regra de caixa de entrada na caixa de correio de um usuário no repositório do Exchange.You can use Exchange Web Services to modify an Inbox rule in a user's mailbox in the Exchange store. Use o elemento UpdateInboxRules em conjunto com o elemento SetRuleOperation para modificar uma regra.Use the UpdateInboxRules element in conjunction with the SetRuleOperation element to modify a rule.

DescriçãoDescription

O cliente cria a solicitação XML e a envia para o servidor.The client constructs the request XML and sends it to the server.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version ="Exchange2010_SP1"/>
  </soap:Header>
  <soap:Body>
      <m:UpdateInboxRules>
        <m:RemoveOutlookRuleBlob>true</m:RemoveOutlookRuleBlob>
        <Operations xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
          <SetRuleOperation xmlns="https://schemas.microsoft.com/exchange/services/2006/types">
            <Rule>
              <RuleId>Nh8AAAAwW/w=</RuleId>
              <DisplayName>(Modified) This is Junk</DisplayName>
              <Priority>1</Priority>
              <IsEnabled>true</IsEnabled>
              <Conditions>
                <ContainsSubjectStrings>
                  <String>Interesting</String>
                </ContainsSubjectStrings>
              </Conditions>
              <Actions>
                <MoveToFolder>
                  <FolderId Id="AAMkADQ1YTE1" ChangeKey="AQAAAA==" />
                </MoveToFolder>
              </Actions>
            </Rule>
          </SetRuleOperation>
        </Operations>
      </m:UpdateInboxRules>
  </soap:Body>
</soap:Envelope>

ComentáriosComments

Este exemplo altera o nome de exibição para "(modificado) isso é lixo eletrônico".This example changes the display name to "(Modified) This is Junk".

Observação

Os valores dos atributos ID e ChangeKey do elemento FolderId foram reduzidos para legibilidade.The values of the Id and ChangeKey attributes of the FolderId element have been shortened for readability.

Elementos RequestRequest elements

A solicitação UpdateInboxRules inclui os seguintes elementos:The UpdateInboxRules request includes the following elements:

O elemento Operations contém o elemento SetRuleOperation para modificar uma regra.The Operations element contains the SetRuleOperation element to modify a rule.

Exemplo de resposta UpdateInboxRules (set rule)UpdateInboxRules (Set Rule) response example

DescriçãoDescription

O exemplo a seguir do corpo SOAP (Simple Object Access Protocol) mostra uma resposta bem-sucedida à solicitação UpdateInboxRules que modifica uma regra.The following Simple Object Access Protocol (SOAP) body example shows a successful response to the UpdateInboxRules request that modifies a rule.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="14" 
        MinorVersion="1" 
        MajorBuildNumber="139" 
        MinorBuildNumber="0" 
        Version="Exchange2010_SP1" 
        xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <UpdateInboxRulesResponse 
          ResponseClass="Success" xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseCode>NoError</ResponseCode>
    </UpdateInboxRulesResponse>
  </s:Body>
</s:Envelope>

Elementos de resposta bem-sucedidosSuccessful response elements

Os seguintes elementos são usados na resposta:The following elements are used in the response:

Exemplo de solicitação UpdateInboxRules (excluir regra)UpdateInboxRules (Delete Rule) request example

Você pode usar os serviços Web do Exchange para excluir uma regra de caixa de entrada na caixa de correio de um usuário no repositório do Exchange.You can use Exchange Web Services to delete an Inbox rule in a user's mailbox in the Exchange store. Use o UpdateInboxRules em conjunto com o elemento DeleteRuleOperation para excluir uma regra.Use the UpdateInboxRules in conjunction with the DeleteRuleOperation element to delete a rule.

DescriçãoDescription

O cliente cria a solicitação XML e a envia para o servidor.The client constructs the request XML and sends it to the server.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version ="Exchange2010_SP1"/>
  </soap:Header>
  <soap:Body>
      <m:UpdateInboxRules>
        <m:RemoveOutlookRuleBlob>true</m:RemoveOutlookRuleBlob>
        <m:Operations>
          <t:DeleteRuleOperation>
            <t:RuleId>Nh8AAAAwW/U=</t:RuleId>
          </t:DeleteRuleOperation>
        </m:Operations>
      </m:UpdateInboxRules>
  </soap:Body>
</soap:Envelope>

ComentáriosComments

Este exemplo exclui a regra identificada existente.This example deletes the existing identified rule.

Elementos RequestRequest elements

A solicitação UpdateInboxRules inclui os seguintes elementos:The UpdateInboxRules request includes the following elements:

O elemento Operations contém o elemento DeleteRuleOperation para excluir uma regra.The Operations element contains the DeleteRuleOperation element to delete a rule.

Exemplo de resposta UpdateInboxRules (excluir regra)UpdateInboxRules (Delete Rule) response example

DescriçãoDescription

O exemplo a seguir do corpo SOAP (Simple Object Access Protocol) mostra uma resposta bem-sucedida à solicitação UpdateInboxRules que exclui uma regra.The following Simple Object Access Protocol (SOAP) body example shows a successful response to the UpdateInboxRules request that deletes a rule.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
    <h:ServerVersionInfo MajorVersion="14" 
        MinorVersion="1" 
        MajorBuildNumber="139" 
        MinorBuildNumber="0" 
        Version="Exchange2010_SP1" 
        xmlns:h="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns="https://schemas.microsoft.com/exchange/services/2006/types" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
  </s:Header>
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <UpdateInboxRulesResponse ResponseClass="Success" xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <ResponseCode>NoError</ResponseCode>
    </UpdateInboxRulesResponse>
  </s:Body>
</s:Envelope>

Elementos de resposta bem-sucedidosSuccessful response elements

Os seguintes elementos são usados na resposta:The following elements are used in the response:

Confira tambémSee also

Operação GetInboxRulesGetInboxRules operation