我需要在用户的日历约会中搜索子字符串。我没有关于约会的任何其他信息(GUID、开始日期等)。我只知道正文中有一个特定的子字符串。
我已经阅读了几篇关于如何获取约会正文的文章,但他们通过 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);
}