EWS (Exchange Webservices)를 사용하여 연락처의 PostOfficeBox에 액세스하려면 어떻게해야합니까?

WimVO

Outlook을 사용하여 고객의 주소록에서 정보를 내보냈습니다. 이제 그는 Exchange를 사용하여 해당 정보를 유지하고 업데이트하기를 원합니다.

이를 위해 Exchange Webservices API를 사용하기로 결정했습니다.

연락처를 검색 할 수 있으며 해당 연락처 내에 직장, 집 및 기타 주소가 포함 된 PhysicalAddresses 열거 형이 있습니다.

이러한 주소는 PhysicalAddressEntry 클래스의 인스턴스입니다.

이 클래스에는 거리 주소, 우편 번호, 도시, 주 및 지역 / 국가가 포함됩니다. (참조 : https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.physicaladdressentry_members(v=exchg.80).aspx )

그러나 Outlook 주소 항목에있는 PostOfficeBox 필드는 포함되지 않습니다.

  • BusinessAddressPostOfficeBox
  • HomeAddressPostOfficeBox
  • MailingAddressPostOfficeBox
  • OtherAddressPostOfficeBox

(참조 : https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/contactitem-object-outlook )

Exchange Webservices API에는 PhysicalAddressEntry 클래스보다 자세한 PersonaPostalAddress 클래스가 있습니다 (참조 : https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.personapostaladdress_properties(v=exchg. 80) .aspx ). 그 사람은 PostOfficeBox 회원이 있습니다.

내 연락처에서 PersonaPostalAddress 항목을 가져 오지 못했습니다 (참조 : https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.contact_properties(v=exchg.80).aspx )

특정 주소에 속하는 PostOfficeBox 필드를 읽고 쓸 수있는 방법이 있습니까?

우리가 이미 확장 속성으로 읽고있는 '사용자 정의'속성이 있으며 이는 PublicStrings 네임 스페이스에 있습니다. (참조 : https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.defaultextendedpropertyset(v=exchg.80).aspx )

PublicStrings, Address 및 Common으로 "OtherAddressPostOfficeBox"라는 확장 속성을 만들려고했지만 반환되지 못했습니다.

opensge / progress 코드를 용서하십시오.하지만 여기에 내가 시도한 것이 있습니다.

DEFINE VARIABLE continent-regio           AS CLASS   Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition NO-UNDO.
DEFINE VARIABLE OtherAddressPostOfficeBox AS CLASS   Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition NO-UNDO.
DEFINE VARIABLE properties                AS CLASS   "Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase[]" NO-UNDO.
ASSIGN continent-regio = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet:PublicStrings,"Continent/Regio",Microsoft.Exchange.WebServices.Data.MapiPropertyType:String).
ASSIGN OtherAddressPostOfficeBox = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet:Common,"OtherAddressPostOfficeBox",Microsoft.Exchange.WebServices.Data.MapiPropertyType:String).

ASSIGN properties = NEW "Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase[]"(3).
properties:SetValue(continent-regio,0).
properties:SetValue(Microsoft.Exchange.WebServices.Data.ContactSchema:PostalAddressIndex,1).
properties:SetValue(OtherAddressPostOfficeBox,2).

contactlijst:PropertySet = NEW Microsoft.Exchange.WebServices.Data.PropertySet(
    Microsoft.Exchange.WebServices.Data.BasePropertySet:FirstClassProperties,
    properties).

DELETE OBJECT properties.

ASSIGN contacten = service:FindItems(Microsoft.Exchange.WebServices.Data.WellKnownFolderName:Contacts, contactlijst).

DO iX = 0 TO contacten:Items:COUNT - 1:
    IF STRING(contacten:Items:Item[iX]:GetType()) EQ "Microsoft.Exchange.WebServices.Data.Contact" THEN DO: /* Mailinglijsten overslaan */
        ASSIGN contactpersoon = CAST(contacten:Items:Item[iX], Microsoft.Exchange.WebServices.Data.Contact).

        DO iY = 0 TO contactpersoon:ExtendedProperties:COUNT - 1:
            CASE contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:NAME:
                WHEN continent-regio:NAME THEN ASSIGN tt-cp.continent-regio = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
                WHEN OtherAddressPostOfficeBox:NAME THEN MESSAGE contactpersoon:ExtendedProperties:ITEM[iY]:VALUE
                    VIEW-AS ALERT-BOX INFO BUTTONS OK.
            END CASE.
        END.

        DELETE OBJECT contactpersoon.
    END.
END.

Continent/Regio이 방법으로 사용자 정의 필드를 읽을 수 있지만 PostOfficeBox 필드 는 읽을 수 없습니다.

ExtendedPropertyDefinition 클래스의 다른 생성자 중 하나를 사용하려면 이러한 필드의 숫자 ID가 필요할 수 있습니다 (참조 : https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.extendedpropertydefinition_members(v = exchg.80) .aspx )하지만 찾을 수없는 것 같습니다.

0x3A64 (14948)가 OtherAddressPostOfficeBox의 ID 일 수 있지만 작동하지 않는 것을 찾은 후 이것을 시도했습니다.

ASSIGN OtherAddressPostOfficeBox = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet:Address,14948,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String).

올바른 속성 식별자를 사용 했습니까? 이런 식으로 작동합니까 아니면 완전히 다른 작업을 수행해야합니까?

편집 : 필드 이름으로 사용 가능한 모든 필드를 채운 Exchange 연락처 항목의 이러한 주소 필드에 대해 무차별 대입 공격을 실행하고 있습니다. 대부분의 경우 Exchange는 내부 서버 오류로 응답하지만 32768부터는 필드가 주기적으로 나타나기 시작합니다.

현재 ID 0x804A / 32842가 BusinessAddressPostOfficeBox와 일치하는지 확인할 수 있으므로 다른 항목이 나타나면 곧 답변이 추가 될 것으로 예상됩니다. 서버에서 직접 PersonaPostalAddress를 가져 오는 방법을 알고 있으면 언제든지 의견을 말하십시오.

Microsoft Exchange Server 2010 SP3 (14.3.123.4002)이 있습니다.

WimVO

BusinessAddressPostOfficeBox 만 Address DefaultExtendedPropertySet에서 검색 할 수있는 필드이므로 생각만큼 간단하지 않았습니다.

그러나이 하나의 필드를 가지고 인터넷에서 다른 항목을 얻는 방법을 설명하는 다음 목록을 찾을 수있었습니다. http://j-integra.intrinsyc.com/support/kb/article.aspx?id=53135

결국 우리 코드는 다음과 같습니다.

ASSIGN BusinessAddressPostOfficeBox = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(Microsoft.Exchange.WebServices.Data.DefaultExtendedPropertySet:Address,32842,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       HomeAddressPostOfficeBox     = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14942,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressCity           = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14887,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressCountry        = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14886,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressPostalCode     = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14890,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressPostOfficeBox  = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14891,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressState          = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14888,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       MailingAddressStreet         = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14889,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)
       OtherAddressPostOfficeBox    = NEW Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition(14948,Microsoft.Exchange.WebServices.Data.MapiPropertyType:String)

ASSIGN properties = NEW "Microsoft.Exchange.WebServices.Data.PropertyDefinitionBase[]"(10).
properties:SetValue(continent-regio,0).
properties:SetValue(BusinessAddressPostOfficeBox,1).
properties:SetValue(HomeAddressPostOfficeBox,2).
properties:SetValue(MailingAddressCity,3).
properties:SetValue(MailingAddressCountry,4).
properties:SetValue(MailingAddressPostalCode,5).
properties:SetValue(MailingAddressPostOfficeBox,6).
properties:SetValue(MailingAddressState,7).
properties:SetValue(MailingAddressStreet,8).
properties:SetValue(OtherAddressPostOfficeBox,9).

contactlijst:PropertySet = NEW Microsoft.Exchange.WebServices.Data.PropertySet(
    Microsoft.Exchange.WebServices.Data.BasePropertySet:FirstClassProperties,
    properties).

ASSIGN contacten = service:FindItems(Microsoft.Exchange.WebServices.Data.WellKnownFolderName:Contacts, contactlijst).

DO iX = 0 TO contacten:Items:COUNT - 1:
    IF STRING(contacten:Items:Item[iX]:GetType()) EQ "Microsoft.Exchange.WebServices.Data.Contact" THEN DO: /* Mailinglijsten overslaan */
        ASSIGN contactpersoon = CAST(contacten:Items:Item[iX], Microsoft.Exchange.WebServices.Data.Contact).

        CREATE tt-cp.
        ASSIGN tt-cp.naam               = contactpersoon:CompleteName:FullName
               tt-cp.firma              = contactpersoon:CompanyName
               tt-cp.initialen          = contactpersoon:Initials
               tt-cp.functie            = contactpersoon:JobTitle
               tt-cp.afdeling           = contactpersoon:Department
/* ... */
        DO iY = 0 TO contactpersoon:ExtendedProperties:COUNT - 1:
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(continent-regio) THEN 
                ASSIGN tt-cp.continent-regio = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(BusinessAddressPostOfficeBox) THEN 
                ASSIGN tt-cp.werkadres-postbus = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(HomeAddressPostOfficeBox) THEN 
                ASSIGN tt-cp.thuisadres-postbus = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressCity) THEN 
                ASSIGN tt-cp.postadres-stad = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressCountry) THEN 
                ASSIGN tt-cp.postadres-land = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressPostalCode) THEN 
                ASSIGN tt-cp.postadres-postcode = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressPostOfficeBox) THEN 
                ASSIGN tt-cp.postadres-postbus = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressState) THEN 
                ASSIGN tt-cp.postadres-staat = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(MailingAddressStreet) THEN 
                ASSIGN tt-cp.postadres-straat = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(OtherAddressPostOfficeBox) THEN 
                ASSIGN tt-cp.anderadres-postbus = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
            IF contactpersoon:ExtendedProperties:ITEM[iY]:PropertyDefinition:Equals(Webpage) THEN 
                ASSIGN tt-cp.webstek = contactpersoon:ExtendedProperties:ITEM[iY]:VALUE.
        END.

따라서 기본적으로 찾고있는 필드에 대해 태그가 지정된 ID가 무엇인지 찾아 확장 속성을 생성하면 반환됩니다.

반환 된 결과 집합을 살펴볼 때 Equals를 사용하여 propertydefinition을 테스트하여 반환 된 결과를 확인할 수 있습니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관