我试图列出与给定日历约会关联的所有属性,但我不知道是否有办法在不单独加载每个属性的情况下完成此操作。根据我在网上看到的一些代码,我知道我可以执行以下操作:
/// <summary>
/// List all the properties of an appointment
/// </summary>
public void listProps()
{
Folder myCalendar = Folder.Bind(service, WellKnownFolderName.Calendar);
ItemView view = new ItemView(10);
FindItemsResults<Item> findResults;
do
{
findResults = myCalendar.FindItems(new SearchFilter.IsEqualTo(ItemSchema.ExtendedProperties, MyPropertySetId), view);
service.LoadPropertiesForItems(findResults, new PropertySet(ItemSchema.Subject, ItemSchema.Body));
foreach (Item item in findResults)
{
Console.WriteLine(item.Subject);
Console.WriteLine(item.Body);
}
if (findResults.NextPageOffset.HasValue)
{
view.Offset = findResults.NextPageOffset.Value;
}
} while (findResults.MoreAvailable);
}
但是,我真正在中间寻找的是这样的伪代码:
service.LoadPropertiesForItems(findResults, new PropertySet(*.*));
foreach (Item item in findResults)
{
Console.WriteLine(property)
}
这可能吗?
谢谢!
最佳答案
不,这是不可能的。
您可以使用预定义的属性集,例如:PropertySet.FirstClassProperties
来获取已知的属性集。
根本不支持以这种方式获取扩展属性。您必须明确指定要访问哪些扩展属性。例如:
ItemView view = new ItemView(10);
ExtendedPropertyDefinition extendedPropertyDefinition =
new ExtendedPropertyDefinition("Expiration Date", MapiPropertyType.String);
view.PropertySet =
new PropertySet(BasePropertySet.FirstClassProperties, ItemSchema.Subject,extendedPropertyDefinition);
关于api - 在 Exchange 2010 中加载所有约会属性,包括扩展属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18134299/