簡體   English   中英

從Exchange / Outlook約會獲取擴展屬性

[英]Getting extended property from Exchange/Outlook appointment

我以這種方式添加擴展屬性:

ExtendedPropertyDefinition ep = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.CalendarAssistant, "AppointmentID", MapiPropertyType.Integer);
Appointment newApp = new Appointment(service);
newapp.SetExtendedProperty(ep, appID);
newApp.Save(SendInvitationsMode.SendToNone);

一切都很好。 該約會將按預期顯示在Outlook中。

稍后,我嘗試搜索由以下人員分配的所有AppointmentID的Outlook約會:

List<SearchFilter> filters = new List<SearchFilter>();
filters.Add(new SearchFilter.Exists(ep));
filters.Add(new SearchFilter.IsLessThan(AppointmentSchema.Start, DateTime.Now.AddDays(60)));
filters.Add(new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, DateTime.Today));
FindItemsResults<Item> allOutlookAppt = service.FindItems(WellKnownFolderName.Calendar, new SearchFilter.SearchFilterCollection(LogicalOperator.And, filters.ToArray()), viewFind);

allOutlookAppt返回期望的集合(設置了AppointmentID的日歷條目)。 但是我無法通過以下代碼檢索AppointmentID:

foreach (var a in allOutlookAppt) // contains correct calendar entries!
{
    object oid;
    if (a.TryGetProperty(ep, out oid))
    {
    // a.TryGetProperty is always false, oid is always null thus never enter here!
    }
}

我做錯了什么?

編輯:我嘗試了a.ExtendedProperties.Count,它實際上返回0。

谷歌搜索了一下之后,我必須在搜索日歷之前添加它

viewFind.PropertySet = new PropertySet(ep);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM