0

결제 정보에 정보가 있으며 EWS Java API를 사용하여 검색하려고합니다. 여기까지 내가 무엇을 가지고있다.EWS Java API를 사용하여 약속에 대한 결제 정보 가져 오기

public List<String> findAppointments() throws Exception 
{ 
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
    Date startDate1 = formatter.parse("2012-08-26 12:00:00"); 
    Date endDate1 = formatter.parse("2012-10-06 13:00:00"); 
    ExchangeService service = createService(); 
    CalendarFolder cf = CalendarFolder.bind(service, WellKnownFolderName.Calendar); 
    FindItemsResults<Appointment> findResults = cf.findAppointments(new CalendarView(startDate1, endDate1)); 
    List<String> calList = new ArrayList<String>(); 

    ExtendedPropertyDefinition BillingInfo = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.Common, "34101" , MapiPropertyType.String); 
    PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties, BillingInfo); 

    for (Appointment appt : findResults.getItems()) { 
     appt = (Appointment)Item.bind(service, new ItemId(appt.getId()), propertySet); 
     for(ExtendedProperty extendedProperty : appt.getExtendedProperties()) { 
      System.out.println("extendedProperty :" + extendedProperty.getValue()); 
     } 
    } 
} 

나는 약속을 지키고있다. 약속 항목을 속성 집합에 바인딩한다.

답변

1

동일한 속성을 가져 오는 작업이 필요했습니다. 다음은 또 다른 API와 함께 예입니다 있지만 논리가 동일해야합니다 : 나는 다른 API를 사용했던 볼 수 있습니다

import java.text.ParseException; 
import java.text.SimpleDateFormat; 
import java.util.Date; 

import com.independentsoft.exchange.And; 
import com.independentsoft.exchange.Appointment; 
import com.independentsoft.exchange.AppointmentPropertyPath; 
import com.independentsoft.exchange.FindItemResponse; 
import com.independentsoft.exchange.IsGreaterThanOrEqualTo; 
import com.independentsoft.exchange.IsLessThanOrEqualTo; 
import com.independentsoft.exchange.ItemShape; 
import com.independentsoft.exchange.MapiPropertyType; 
import com.independentsoft.exchange.PropertyId; 
import com.independentsoft.exchange.Service; 
import com.independentsoft.exchange.ServiceException; 
import com.independentsoft.exchange.StandardFolder; 
import com.independentsoft.exchange.StandardPropertySet; 

public class Test { 

    public static void main(String[] args) 
    { 
     try 
     { 
      Service service = new Service("https://myserver/ews/Exchange.asmx", "username", "password"); 

      SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
      Date startTime = dateFormat.parse("2012-09-15 00:00:00"); 
      Date endTime = dateFormat.parse("2012-09-16 00:00:00"); 

      IsGreaterThanOrEqualTo restriction1 = new IsGreaterThanOrEqualTo(AppointmentPropertyPath.START_TIME, startTime); 
      IsLessThanOrEqualTo restriction2 = new IsLessThanOrEqualTo(AppointmentPropertyPath.END_TIME, endTime); 
      And restriction3 = new And(restriction1, restriction2); 

      PropertyId billingInformationPropertyId = new PropertyId(0x8535, StandardPropertySet.COMMON, MapiPropertyType.STRING); 

      ItemShape shape = new ItemShape(AppointmentPropertyPath.getAllPropertyPaths()); 
      shape.getPropertyPaths().add(billingInformationPropertyId); 

      FindItemResponse response = service.findItem(StandardFolder.CALENDAR, shape, restriction3); 

      for (int i = 0; i < response.getItems().size(); i++) 
      { 
       if (response.getItems().get(i) instanceof Appointment) 
       { 
        Appointment appointment = (Appointment) response.getItems().get(i); 

        System.out.println("Subject = " + appointment.getSubject()); 
        System.out.println("StartTime = " + appointment.getStartTime()); 
        System.out.println("EndTime = " + appointment.getEndTime());      

        if (appointment.getExtendedProperty(billingInformationPropertyId) != null) 
        { 
         System.out.println("Billing Information = " + appointment.getExtendedProperty(billingInformationPropertyId).getValue()); 
        } 
       } 
      } 
     } 
     catch (ServiceException e) 
     { 
      System.out.println(e.getMessage()); 
      System.out.println(e.getXmlMessage()); 

      e.printStackTrace(); 
     } 
     catch (ParseException e) 
     { 
      e.printStackTrace(); 
     } 
    } 
} 
+0

,하지만 내가해야 할 것은 어떻게 든 속성 항목 (약속)으로 설정 속성을 결합하는 것입니다. 여기가 내가 붙어있는 곳이야. 이 모든 도움을 주시면 감사하겠습니다. EWS Java API를 사용하고 있습니다. – user1024529

관련 문제