/** * Creates a read-only PropertySet. * * @param basePropertySet The base property set. * @return PropertySet */ private static PropertySet createReadonlyPropertySet( BasePropertySet basePropertySet) { PropertySet propertySet = new PropertySet(basePropertySet); propertySet.isReadOnly = true; return propertySet; }
/** * Adds the specified property to the property set. * * @param properties The property to add. * @throws Exception the exception */ public void addRange(Iterable<PropertyDefinitionBase> properties) throws Exception { this.throwIfReadonly(); Iterator<PropertyDefinitionBase> property = properties.iterator(); EwsUtilities.validateParamCollection(property, "property"); for (Iterator<PropertyDefinitionBase> it = properties.iterator(); it .hasNext(); ) { this.add(it.next()); } }
/** * Checks if is requested property. * * @param propertyDefinition the property definition * @return true, if is requested property */ private boolean isRequestedProperty(PropertyDefinition propertyDefinition) { // If no requested property set, then property wasn't requested. if (this.requestedPropertySet == null) { return false; } // If base property set is all first-class property, use the // appropriate list of // property definitions to see if this property was requested. // Otherwise, property had // to be explicitly requested and needs to be listed in // AdditionalProperties. if (this.requestedPropertySet.getBasePropertySet() == BasePropertySet.FirstClassProperties) { List<PropertyDefinition> firstClassProps = this.onlySummaryPropertiesRequested ? this .getOwner().getSchema().getFirstClassSummaryProperties() : this.getOwner().getSchema().getFirstClassProperties(); return firstClassProps.contains(propertyDefinition) || this.requestedPropertySet.contains(propertyDefinition); } else { return this.requestedPropertySet.contains(propertyDefinition); } }
this.getBasePropertySet().getBaseShapeValue()); if (this.getRequestedBodyType() != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.BodyType, this.getRequestedBodyType()); if (this.getFilterHtmlContent() != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.FilterHtmlContent, this .getFilterHtmlContent()); if ((this.getConvertHtmlCodePageToUTF8() != null) && writer.getService().getRequestedServerVersion(). compareTo(ExchangeVersion.Exchange2010_SP1) >= 0) { XmlNamespace.Types, XmlElementNames.ConvertHtmlCodePageToUTF8, this.getConvertHtmlCodePageToUTF8()); writeAdditionalPropertiesToXml(writer, this.additionalProperties .iterator());
/** * Load. * * @throws Exception the exception */ public void load() throws Exception { this.internalLoad(PropertySet.getFirstClassProperties()); }
view.setPropertySet(new PropertySet(BasePropertySet.IdOnly)); view.getPropertySet().add(FolderSchema.DisplayName); view.setTraversal(FolderTraversal.Deep); FindFoldersResults findFolderResults = service.findFolders(rootFolderId, view);
private PropertySet createCalendarPropertySet() { final PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties); propertySet.setRequestedBodyType(BodyType.Text); return propertySet; }
if (this.getContactDataPropertySet() != null) { if (PropertySet.getDefaultPropertySetMap().getMember() .containsKey(this.getContactDataPropertySet().getBasePropertySet())) { propertySet = PropertySet.getDefaultPropertySetMap().getMember() .get(this.getContactDataPropertySet().getBasePropertySet());
if (this.getFilterHtmlContent() != null) { if (request.getService().getRequestedServerVersion().compareTo(ExchangeVersion.Exchange2010) < 0) { throw new ServiceVersionException( if (this.getConvertHtmlCodePageToUTF8() != null) { if (request.getService().getRequestedServerVersion().compareTo(ExchangeVersion.Exchange2010_SP1) < 0) { throw new ServiceVersionException(
this.getBasePropertySet().getBaseShapeValue()); if (this.getRequestedBodyType() != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.BodyType, this.getRequestedBodyType()); if (this.getFilterHtmlContent() != null) { writer.writeElementValue(XmlNamespace.Types, XmlElementNames.FilterHtmlContent, this .getFilterHtmlContent()); if ((this.getConvertHtmlCodePageToUTF8() != null) && writer.getService().getRequestedServerVersion(). compareTo(ExchangeVersion.Exchange2010_SP1) >= 0) { XmlNamespace.Types, XmlElementNames.ConvertHtmlCodePageToUTF8, this.getConvertHtmlCodePageToUTF8()); writeAdditionalPropertiesToXml(writer, this.additionalProperties .iterator());
/** * Binds to an existing meeting response and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service The service to use to bind to the meeting request. * @param id The Id of the meeting request to bind to. * @return A MeetingResponse instance representing the meeting request * corresponding to the specified Id. */ public static MeetingRequest bind(ExchangeService service, ItemId id) { return MeetingRequest.bind(service, id, PropertySet .getFirstClassProperties()); }
ExchangeService mailbox = new ExchangeService(ExchangeVersion.Exchange2007_SP1); mailbox.setUrl(new URL("https://remote.domain.com/EWS/exchange.asmx").toURI()); ExchangeCredentials credentials = new WebCredentials("user.name", "password", "domain"); mailbox.setCredentials(credentials); ExtendedPropertyDefinition titlePropDef = new ExtendedPropertyDefinition(0x3A45, MapiPropertyType.String); Contact c = new Contact(mailbox); c.setGivenName("GivenName"); c.setSurname("Surname"); c.getEmailAddresses().setEmailAddress(EmailAddressKey.EmailAddress1, new EmailAddress("asdf@asdf.com")); c.setExtendedProperty(titlePropDef, "TitleXYZ"); c.save(WellKnownFolderName.Contacts); Contact result = (Contact) mailbox.findItems(WellKnownFolderName.Contacts, new ItemView(1)).iterator().next(); PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties); propertySet.add(titlePropDef); result = Contact.bind(mailbox, result.getId(), propertySet); System.out.println("count: " + result.getExtendedProperties().getCount()); for(ExtendedProperty p : result.getExtendedProperties()) { System.out.println(p.toString()); }
if (this.getContactDataPropertySet() != null) { if (PropertySet.getDefaultPropertySetMap().getMember() .containsKey(this.getContactDataPropertySet().getBasePropertySet())) { propertySet = PropertySet.getDefaultPropertySetMap().getMember() .get(this.getContactDataPropertySet().getBasePropertySet());
if (this.getFilterHtmlContent() != null) { if (request.getService().getRequestedServerVersion().compareTo(ExchangeVersion.Exchange2010) < 0) { throw new ServiceVersionException( if (this.getConvertHtmlCodePageToUTF8() != null) { if (request.getService().getRequestedServerVersion().compareTo(ExchangeVersion.Exchange2010_SP1) < 0) { throw new ServiceVersionException(
/** * Implements an implicit conversion between * PropertySet and BasePropertySet. * * @param basePropertySet The BasePropertySet value to convert from. * @return A PropertySet instance based on the specified base property set. */ public static PropertySet getPropertySetFromBasePropertySet(BasePropertySet basePropertySet) { return new PropertySet(basePropertySet); }
/** * Binds to an existing task and loads its first class property. Calling * this method results in a call to EWS. * * @param service the service * @param id the id * @return A Task instance representing the task corresponding to the * specified Id. * @throws Exception the exception */ public static Task bind(ExchangeService service, ItemId id) throws Exception { return Task.bind(service, id, PropertySet.getFirstClassProperties()); }
/** * Adds the specified property to the property set. * * @param properties The property to add. * @throws Exception the exception */ public void addRange(Iterable<PropertyDefinitionBase> properties) throws Exception { this.throwIfReadonly(); Iterator<PropertyDefinitionBase> property = properties.iterator(); EwsUtilities.validateParamCollection(property, "property"); for (Iterator<PropertyDefinitionBase> it = properties.iterator(); it .hasNext(); ) { this.add(it.next()); } }
/** * Checks if is requested property. * * @param propertyDefinition the property definition * @return true, if is requested property */ private boolean isRequestedProperty(PropertyDefinition propertyDefinition) { // If no requested property set, then property wasn't requested. if (this.requestedPropertySet == null) { return false; } // If base property set is all first-class property, use the // appropriate list of // property definitions to see if this property was requested. // Otherwise, property had // to be explicitly requested and needs to be listed in // AdditionalProperties. if (this.requestedPropertySet.getBasePropertySet() == BasePropertySet.FirstClassProperties) { List<PropertyDefinition> firstClassProps = this.onlySummaryPropertiesRequested ? this .getOwner().getSchema().getFirstClassSummaryProperties() : this.getOwner().getSchema().getFirstClassProperties(); return firstClassProps.contains(propertyDefinition) || this.requestedPropertySet.contains(propertyDefinition); } else { return this.requestedPropertySet.contains(propertyDefinition); } }
private PropertySet createEmailPropertySet() { final ExtendedPropertyDefinition[] extendedPropertyDefinitions = new ExtendedPropertyDefinition[]{PR_FLAG_STATUS, PR_TASK_DUE_DATE}; final PropertySet propertySet = new PropertySet(BasePropertySet.FirstClassProperties, extendedPropertyDefinitions); return propertySet; }