3
我需要在用戶的日曆約會中搜索子字符串。我沒有關於約會的其他信息(GUID,開始日期等)。我只知道一個特定的子字符串在主體中。EWS搜索子任務的約會正文
我已經閱讀了一些關於如何獲得約會正文的文章,但他們通過GUID或主題進行搜索。我試圖使用下面的代碼來搜索正文中的子字符串,但是我得到一個錯誤,我無法在FindItems
中使用正文。
有沒有辦法做到這一點?假設我無法從約會中獲得任何其他信息,是否還有其他方法可以採用?
//Variables
ItemView view = new ItemView(10);
view.PropertySet = new PropertySet(EmailMessageSchema.Body);
SearchFilter sfSearchFilter;
FindItemsResults<Item> findResults;
foreach (string s in substrings)
{
//Search for messages with body containing our permURL
sfSearchFilter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Body, s);
findResults = service.FindItems(WellKnownFolderName.Calendar, sfSearchFilter, view);
if (findResults.TotalCount != 0)
{
Item appointment = findResults.FirstOrDefault();
appointment.SetExtendedProperty(extendedPropertyDefinition, s);
}