0

I am trying to fetch task details from Microsoft Exchange Server using following code

    public List readTask() throws Exception{
    //Create the extended property definition.
     try {
    Task t=new Task(service);
    ExtendedPropertyDefinition taskCompleteProp = new 
    ExtendedPropertyDefinition(DefaultExtendedPropertySet.Task, 0x0000811C, 
    MapiPropertyType.Boolean);
    //Create the search filter.
    SearchFilter.IsEqualTo filter = new 
    SearchFilter.IsEqualTo(taskCompleteProp, false);                    
    //Get the tasks.

    FindItemsResults<Item> tasks = 
    service.findItems(WellKnownFolderName.Tasks, filter, new ItemView(50));

    service.loadPropertiesForItems(tasks.getItems(), new PropertySet());

    for(Item task:tasks){
        task.load();
        System.out.println(task.getSubject());
        System.out.println(task.getBody());


    }
    return null;
    }

How should i get the task start and duedate of particular task in for loop

MadDev
  • 1,130
  • 1
  • 13
  • 29
Mohit Mehral
  • 307
  • 1
  • 3
  • 9

1 Answers1

0

it was really very simple.

      for(Item task:tasks){
        task.load();
        Task tde=(Task) task;
        System.out.println(tde.getSubject());
        System.out.println(tde.getBody());
        System.out.println(tde.getStartDate());
        System.out.println(tde.getDueDate());
       }
Mohit Mehral
  • 307
  • 1
  • 3
  • 9