2017-08-04 14 views
0

私たちは顧客のアドレス帳からOutlookを使用して情報をエクスポートしました。 ここで、Exchangeを使用してその情報を維持および更新したいと考えています。Exchange Webservices(EWS)を使用して連絡先のPostOfficeBoxにアクセスするにはどうすればよいですか?

この目的で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クラス(詳細:https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.personapostaladdress_properties(v=exchg.80).aspx参照)より詳細なPersonaPostalAddressクラスがあります。それにはPostOfficeBoxのメンバーがいます。私は私の連絡先のうち、PersonaPostalAddressエントリを得ることに成功していない

(参照: https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.contact_properties(v=exchg.80).aspx)を

特定のアドレスに属しPostOfficeBoxフィールドを読み、多分書くための方法はありますか?

は、我々はすでに拡張プロパティとして読んでいる「ユーザー定義された」プロパティがあり、それらはPublicStrings名前空間にあります。 (参照:)

PublicStrings、Address、Commonとして "OtherAddressPostOfficeBox"という拡張プロパティを作成しようとしましたが、返されませんでした。

はopenedge /進行コードを許すが、ここで私が試したものです:

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. 

我々はPostOfficeBoxフィールドカスタムContinent/Regioフィールドをこのように読むことはできませんが。

ExtendedPropertyDefinitionクラス(参照:https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.extendedpropertydefinition_members(v=exchg.80).aspx)の他のコンストラクタの1つを使用するには、これらのフィールドの数値IDが必要なのでしょうが、見つけられないようです。

私は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をサーバから直接取得する方法を知っていれば、気軽にコメントしてください。

我々は唯一BusinessAddressPostOfficeBoxはアドレスDefaultExtendedPropertySetの外に取り出すことができる場であるとして私が思ったほど簡単ではなかったのMicrosoft Exchange Server 2010 SP3(14.3.123.4002)

答えて

0

を持っています。 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を使用してプロパティ定義をテストして、返された結果セットを確認することができます。

関連する問題