Operação AddDelegateAddDelegate operation

A operação AddDelegate adiciona um ou mais representantes à caixa de correio de uma entidade de segurança e define permissões de acesso específicas.The AddDelegate operation adds one or more delegates to a principal's mailbox and sets specific access permissions.

Cabeçalhos SOAPSOAP headers

A operação AddDelegate pode usar os cabeçalhos SOAP listados e descritos na tabela a seguir.The AddDelegate operation can use the SOAP headers that are listed and described in the following table.

HeaderHeader ElementoElement DescriçãoDescription
RepresentaçãoImpersonation
ExchangeImpersonationExchangeImpersonation
Identifica o usuário que o aplicativo cliente está representando.Identifies the user whom the client application is impersonating.
MailboxCultureMailboxCulture
MailboxCultureMailboxCulture
Identifica a cultura RFC3066 a ser usada para acessar a caixa de correio.Identifies the RFC3066 culture to be used to access the mailbox.
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
Identifica a versão do esquema para a solicitação de operação.Identifies the schema version for the operation request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
Identifica a versão do servidor que respondeu à solicitação.Identifies the version of the server that responded to the request.

Exemplo de solicitação AddDelegateAddDelegate request example

DescriçãoDescription

O exemplo a seguir de uma solicitação AddDelegate mostra uma tentativa de conceder as permissões de representante Usuário1 em pastas pertencentes a Usuário2.The following example of an AddDelegate request shows an attempt to give user1 delegate permissions on folders that are owned by user2. O Usuário1 recebe permissões no nível do autor para a pasta calendário do user2's e permissões no nível do revisor para a pasta contatos do user2's.User1 is given Author-level permissions to user2's Calendar folder and Reviewer-level permissions to user2's Contacts folder. Usuário1 não receberá cópias de mensagens de reunião e não poderá exibir itens privados na caixa de correio do user2's.User1 will not receive copies of meeting messages and will be unable to view private items in user2's mailbox. As solicitações de reunião serão enviadas para usuário1 e Usuário2.Meeting requests will be sent to both user1 and user2.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2007_SP1"/>
  </soap:Header>
  <soap:Body xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
    <AddDelegate>
      <Mailbox>
        <t:EmailAddress>user2@example.com</t:EmailAddress>
      </Mailbox>
      <DelegateUsers>
        <t:DelegateUser>
          <t:UserId>
            <t:PrimarySmtpAddress>user1@example.com</t:PrimarySmtpAddress>
          </t:UserId>
          <t:DelegatePermissions>
            <t:CalendarFolderPermissionLevel>Author</t:CalendarFolderPermissionLevel>
            <t:ContactsFolderPermissionLevel>Reviewer</t:ContactsFolderPermissionLevel>
          </t:DelegatePermissions>
          <t:ReceiveCopiesOfMeetingMessages>false</t:ReceiveCopiesOfMeetingMessages>
          <t:ViewPrivateItems>false</t:ViewPrivateItems>
        </t:DelegateUser>
      </DelegateUsers>
      <DeliverMeetingRequests>DelegatesAndMe</DeliverMeetingRequests>
    </AddDelegate>
  </soap:Body>
</soap:Envelope>

Exemplo de resposta AddDelegateAddDelegate response example

DescriçãoDescription

O exemplo a seguir de uma resposta AddDelegate mostra uma resposta bem-sucedida a uma solicitação adddelegar .The following example of an AddDelegate response shows a successful response to an AddDelegate request.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" 
                         MinorVersion="1" 
                         MajorBuildNumber="206" 
                         MinorBuildNumber="0" 
                         Version="Exchange2007_SP1" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <m:AddDelegateResponse xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" 
                           ResponseClass="Success" 
                           xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseCode>NoError</m:ResponseCode>
      <m:ResponseMessages>
        <m:DelegateUserResponseMessageType ResponseClass="Success">
          <m:ResponseCode>NoError</m:ResponseCode>
          <m:DelegateUser>
              <t:UserId>
                <t:SID>S-1-5-21-1333220396-2200287332-232816053-1116</t:SID>
                <t:PrimarySmtpAddress>User1@example.com</t:PrimarySmtpAddress>
                <t:DisplayName>User1</t:DisplayName>
              </t:UserId>
              <t:ReceiveCopiesOfMeetingMessages>false</t:ReceiveCopiesOfMeetingMessages>
            <t:ViewPrivateItems>false</t:ViewPrivateItems>
            </m:DelegateUser>
        </m:DelegateUserResponseMessageType>
      </m:ResponseMessages>
    </m:AddDelegateResponse>
  </soap:Body>
</soap:Envelope>

Exemplo de resposta de erro AddDelegateAddDelegate error response example

DescriçãoDescription

O exemplo a seguir mostra a resposta a uma solicitação para adicionar um representante que já foi adicionado à caixa de correio da entidade de segurança.The following example shows the response to a request to add a delegate who has already been added to the principal's mailbox.

CódigoCode

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <t:ServerVersionInfo MajorVersion="8" 
                         MinorVersion="1" 
                         MajorBuildNumber="206" 
                         MinorBuildNumber="0" 
                         Version="Exchange2007_SP1" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <m:AddDelegateResponse xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
                           ResponseClass="Success"
                           xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseCode>NoError</m:ResponseCode>
      <m:ResponseMessages>
        <m:DelegateUserResponseMessageType ResponseClass="Error">
          <m:MessageText>The user is already a delegate for the mailbox.</m:MessageText>
          <m:ResponseCode>ErrorDelegateAlreadyExists</m:ResponseCode>
          <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
        </m:DelegateUserResponseMessageType>
      </m:ResponseMessages>
      </m:AddDelegateResponse>
  </soap:Body>
</soap:Envelope>

ComentáriosComments

Se o código de resposta ErrorDelegateAlreadyExists for retornado quando você tentar adicionar um representante, use a operação getdelegate para obter todas as permissões atuais para o representante e, em seguida, use a operação UpdateDelegate para definir as novas permissões.If the ErrorDelegateAlreadyExists response code is returned when you try to add a delegate, use the GetDelegate operation to get all the current permissions for the delegate, and then use the UpdateDelegate operation to set the new permissions.

Confira tambémSee also