[openmapi.org devel] Better API for named properties
Johannes Roith
johannes at jroith.de
Sat Aug 22 14:03:33 CEST 2009
Hello, everyone!
I have recently made a couple of changes to NMapi that make working
with "named properties" much more convenient.
You can now use the ResolveNamedProperties () method on the IMapiProp
interface which will return a resolver-object which can be passed back
into the named property declarations to create a property tag which is
then used to fetch the properties from the store.
Example:
IMessage contact = (IMessage) store.OpenEntry ( ... );
NamedPropertyResolver resolver = contact.ResolveNamedProperties (
NamedProperty.YomiFirstName,
NamedProperty.FileUnder);
PropertyValue[] values = contact.GetProperties (
NamedProperty.YomiFirstName.CreateTag (resolver),
NamedProperty.FileUnder.CreateTag (resolver));
string yomiFirstName = (string) values [0];
int fileUnder = (int) values [1];
Setting properties is similiar:
IMessage contact = (IMessage) store.OpenEntry ( ... );
NamedPropertyResolver resolver = contact.ResolveNamedProperties
(NamedProperty.YomiFirstName);
contact.SetProperties (
NamedProperty.YomiFirstName.CreateTag (resolver).CreateValue ("blub");
);
contact.SaveChanges ();
The new API will be available in the git next week.
Johannes.
More information about the Devel
mailing list