EWS -确定参与者是房间还是资源,而不是人

本文关键字:资源 房间 参与者 EWS | 更新日期: 2023-09-27 18:07:22

给定EWS中的Attendee,我如何确定该与会者是房间还是资源,而不是人?

EWS -确定参与者是房间还是资源,而不是人

第一件事就是检查与会者是否在资源强类型属性https://msdn.microsoft.com/en-us/library/exchangewebservices.calendaritemtype.resources(v=exchg.80).aspx中,如果您使用EWS获得日历项,这是将返回房间和资源的地方,而不是必需的和可选的与会者。

如果与会者在全局地址列表中,并且您有2013或更高版本,那么您也可以使用FindPeople并检查返回的PersonaType eg

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
              xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2013" />
  </soap:Header>
  <soap:Body >
    <m:FindPeople>
      <m:PersonaShape>
        <t:BaseShape>Default</t:BaseShape>
      </m:PersonaShape>
      <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="100" Offset="0"/>
      <m:ParentFolderId>
        <t:DistinguishedFolderId Id="directory"/>
      </m:ParentFolderId>
      <m:QueryString>Adams@ddddd.onmicrosoft.com</m:QueryString>
    </m:FindPeople>
  </soap:Body>
</soap:Envelope>

对于房间 ,

应该返回如下内容

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:ServerVersionInfo MajorVersion="15" MinorVersion="1" MajorBuildNumber="629" MinorBuildNumber="8" Version="V2016_07_13" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
    </s:Header>
    <s:Body>
        <FindPeopleResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ResponseCode>NoError</ResponseCode>
            <People>
                <Persona xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
                    <PersonaId Id="AAUQAGDlxBsmUDpClBbAI1WX04o=" />
                    <PersonaType>Room</PersonaType>
                    <CreationTime>0001-01-02T00:00:00Z</CreationTime>
                    <DisplayName>Conf Room Adams</DisplayName>
                    <DisplayNameFirstLast>Conf Room Adams</DisplayNameFirstLast>
                    <DisplayNameLastFirst>Conf Room Adams</DisplayNameLastFirst>
                    <FileAs />
                    <EmailAddress>
                        <Name>Conf Room Adams</Name>
                        <EmailAddress>Adams@dddddd.onmicrosoft.com</EmailAddress>
                        <RoutingType>SMTP</RoutingType>
                        <MailboxType>Mailbox</MailboxType>
                    </EmailAddress>
                    <EmailAddresses>
                        <Address>
                            <Name>Conf Room Adams</Name>
                            <EmailAddress>Adams@dddddd.onmicrosoft.com</EmailAddress>
                            <RoutingType>SMTP</RoutingType>
                            <MailboxType>Mailbox</MailboxType>
                        </Address>
                    </EmailAddresses>
                    <RelevanceScore>2147483647</RelevanceScore>
                </Persona>
            </People>
            <TotalNumberOfPeopleInView>0</TotalNumberOfPeopleInView>
            <FirstMatchingRowIndex>0</FirstMatchingRowIndex>
            <FirstLoadedRowIndex>0</FirstLoadedRowIndex>
        </FindPeopleResponse>
    </s:Body>
</s:Envelope>