Exchange Webservice Managed API - Find items by extended properties

前端 未结 3 918
抹茶落季
抹茶落季 2021-01-12 19:57

I have tried to use extended properties on appointments with EWS, but I can not seem to find the appointments again. The set property part is equal to the one shown in this

3条回答
  •  轮回少年
    2021-01-12 20:15

    here's a samplecode how to create an appointment with the customid and find it after saving:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
            service.AutodiscoverUrl("someone@somewhere.com");
    
            ExtendedPropertyDefinition def = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "AppointmenId", MapiPropertyType.String);
    
            Guid testid = Guid.NewGuid ();
    
            Appointment appointment = new Appointment(service);
            appointment.Subject = "Test";
            appointment.Start = DateTime.Now.AddHours(1);
            appointment.End = DateTime.Now.AddHours(2);
            appointment.SetExtendedProperty(def, testid.ToString());
            appointment.Save(WellKnownFolderName.Calendar);
    
            SearchFilter filter = new SearchFilter.IsEqualTo(def, testid.ToString());
    
            FindItemsResults fir = service.FindItems(WellKnownFolderName.Calendar, filter, new ItemView(10));
    

    hope this helps you...

提交回复
热议问题