GetSharingFolder 操作GetSharingFolder operation

GetSharingFolder操作获取指定的共享文件夹的本地文件夹标识符。The GetSharingFolder operation gets the local folder identifier of a specified shared folder.

SOAP 标头SOAP Headers

GetSharingFolder操作可以使用下表中列出和描述的 SOAP 标头。The GetSharingFolder operation can use the SOAP headers that are listed and described in the following table.

HeaderHeader 元素Element 说明Description
RequestVersionRequestVersion
RequestServerVersionRequestServerVersion
标识操作请求的架构版本。Identifies the schema version for the operation request.
ServerVersionServerVersion
ServerVersionInfoServerVersionInfo
标识响应请求的服务器版本。Identifies the version of the server that responded to the request.

GetSharingFolder 请求示例GetSharingFolder request example

通过指定要共享的文件夹的 SharedFolderId 元素获取本地文件夹标识符Getting the Local Folder Identifier by Specifying the SharedFolderId Element of the Folder Being Shared

下面的代码示例演示如何形成一个请求,以获取与所共享的文件夹对应的本地文件夹的标识符。The following code example shows how to form a request to get the identifier of the local folder that corresponds to the folder that is being shared. 共享的文件夹由包含要共享的文件夹的邮箱的 SMTP 地址和代表该文件夹的标识符的SharedFolderId元素标识。The folder that is being shared is identified by the SMTP address of the mailbox that contains the folder that is being shared and by the SharedFolderId element that represents the identifier of that folder. 在此示例中,共享的文件夹由 user1@contoso.com 拥有。In this example, the folder that is being shared is owned by user1@contoso.com.

代码Code

<?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"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <m:GetSharingFolder>
      <m:SmtpAddress>user1@contoso.com</m:SmtpAddress>
      <m:SharedFolderId>AAMkA=</m:SharedFolderId>
    </m:GetSharingFolder>
  </soap:Body>
</soap:Envelope>

通过指定要共享的文件夹的 DataType 元素获取本地文件夹标识符Getting the Local Folder Identifier by Specifying the DataType Element of the Folder Being Shared

下面的代码示例演示如何形成一个请求,以获取与所共享的文件夹对应的本地文件夹的标识符。The following code example shows how to form a request to get the identifier of the local folder that corresponds to the folder that is being shared. 共享的文件夹由包含要共享的文件夹的邮箱的 SMTP 地址和表示该文件夹中的数据类型的DataType元素标识。The folder that is being shared is identified by the SMTP address of the mailbox that contains the folder that is being shared and by the DataType element that represents the type of data in that folder. 在此示例中,共享的文件夹是由 user1@contoso.com 拥有的 "联系人" 文件夹。In this example, the folder that is being shared is the Contacts folder that is owned by user1@contoso.com.

代码Code

<?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"
               xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
               xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010"/>
  </soap:Header>
  <soap:Body>
    <m:GetSharingFolder>
      <m:SmtpAddress>user1@contoso.com</m:SmtpAddress>
      <m:DataType>Contacts</m:DataType>
    </m:GetSharingFolder>
  </soap:Body>
</soap:Envelope>

备注Comments

有关datatype元素的可能值的信息,请参阅datatypeFor information about the possible values of the DataType element, see DataType.

成功的 GetSharingFolder 响应Successful GetSharingFolder Response

DescriptionDescription

下面的示例演示对GetSharingFolder请求的成功响应。The following example shows a successful response to a GetSharingFolder request. SharingFolderId元素的Id属性表示共享关系中的本地文件夹的标识符。The Id attribute of the SharingFolderId element represents the identifier of the local folder in the sharing relationship.

代码Code

<?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="14" 
                         MinorVersion="0" 
                         MajorBuildNumber="639" 
                         MinorBuildNumber="11" 
                         Version="Exchange2010" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetSharingFolderResponseMessage ResponseClass="Success"
                                xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
                                xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
                                xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:ResponseCode>NoError</m:ResponseCode>
      <m:SharingFolderId Id="AAMkAD=" ChangeKey="AwAAA=" />
    </GetSharingFolderResponseMessage>
  </soap:Body>
</soap:Envelope>

GetSharingFolder 错误响应GetSharingFolder error response

DescriptionDescription

下面的示例演示对GetSharingFolder请求的错误响应。The following example shows an error response to a GetSharingFolder request. 在此示例中,由于请求同时指定了SharingFolderIdDataType元素,导致错误发生。In this example, the error occurred because the request specified both the SharingFolderId and DataType elements. 请注意,只能指定这两个元素中的一个或多个,但不能同时指定这两个元素。Note that only one or the other of those two elements can be specified, but not both.

代码Code

<?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="14" 
                         MinorVersion="0" 
                         MajorBuildNumber="639" 
                         MinorBuildNumber="11" 
                         Version="Exchange2010" 
                         xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types" />
  </soap:Header>
  <soap:Body>
    <GetSharingFolderResponseMessage ResponseClass="Error" 
                                xmlns:t="https://schemas.microsoft.com/exchange/services/2006/types"
                                xmlns:m="https://schemas.microsoft.com/exchange/services/2006/messages"
                                xmlns="https://schemas.microsoft.com/exchange/services/2006/messages">
      <m:MessageText>Either DataType or SharedFolderId must be specified, but not both.</m:MessageText>
      <m:ResponseCode>ErrorInvalidGetSharingFolderRequest</m:ResponseCode>
      <m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
    </GetSharingFolderResponseMessage>
  </soap:Body>
</soap:Envelope>

另请参阅See also

GetSharingFolderGetSharingFolder

GetSharingFolderTypeGetSharingFolderType

GetSharingFolderResponseMessageGetSharingFolderResponseMessage

GetSharingFolderResponseMessageTypeGetSharingFolderResponseMessageType

Exchange 中的 EWS 操作EWS operations in Exchange