Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# EWS搜索子字符串的约会正文_C#_Calendar_Exchangewebservices_Appointment - Fatal编程技术网

C# EWS搜索子字符串的约会正文

C# EWS搜索子字符串的约会正文,c#,calendar,exchangewebservices,appointment,C#,Calendar,Exchangewebservices,Appointment,我需要在用户的日历约会中搜索子字符串。我没有关于约会的任何其他信息(GUID、开始日期等)。我只知道身体里有一个特殊的子串 我读过几篇关于如何获取约会正文的文章,但它们是按GUID或主题搜索的。我试图使用下面的代码在正文中搜索子字符串,但我得到一个错误,即我无法在FindItems中使用正文 有办法做到这一点吗?假设我无法从约会中获得任何其他信息,我可以采取其他方法吗 //Variables ItemView view = new ItemView(10);

我需要在用户的日历约会中搜索子字符串。我没有关于约会的任何其他信息(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);
             }
//变量
ItemView视图=新的ItemView(10);
view.PropertySet=newpropertyset(EmailMessageSchema.Body);
搜索过滤器;
FindItemsResults findResults;
foreach(子字符串中的字符串s)
{
//搜索正文中包含我们的永久URL的邮件
sfSearchFilter=newsearchfilter.ContainsSubstring(EmailMessageSchema.Body,s);
findResults=service.FindItems(WellKnownFolderName.Calendar、sfSearchFilter、view);
如果(findResults.TotalCount!=0)
{
Item appointment=findResults.FirstOrDefault();
任命。SetExtendedProperty(extendedPropertyDefinition,s);
}

因此,您可以搜索正文,但不能返回带有
FindItems
的正文。如果您想使用它,您必须稍后加载它。因此,我没有将我的属性集设置为正文,而是将其设置为
I仅
,然后设置
搜索过滤器
,以遍历
项目架构的正文>
        //Return one result--there should only be one in this case
        ItemView view = new ItemView(1);
        view.PropertySet = new PropertySet(BasePropertySet.IdOnly);

        //variables
        SearchFilter sfSearchFilter;
        FindItemsResults<Item> findResults;

        //for each string in list
        foreach (string s in permURLs)
        {
            //Search ItemSchema.Body for the string
            sfSearchFilter = new SearchFilter.ContainsSubstring(ItemSchema.Body, s);
            findResults = service.FindItems(WellKnownFolderName.Calendar, sfSearchFilter, view);

            if (findResults.TotalCount != 0)
            {
                Item appointment = findResults.FirstOrDefault();
                appointment.SetExtendedProperty(extendedPropertyDefinition, s);
                ...
                appointment.Load(new PropertySet(ItemSchema.Body));
                string strBody = appointment.Body.Text;
            }
         }
//返回一个结果——在这种情况下应该只有一个结果
ItemView视图=新的ItemView(1);
view.PropertySet=newpropertyset(BasePropertySet.IdOnly);
//变数
搜索过滤器;
FindItemsResults findResults;
//对于列表中的每个字符串
foreach(permURL中的字符串s)
{
//在ItemSchema.Body中搜索字符串
sfSearchFilter=newsearchfilter.ContainsSubstring(ItemSchema.Body,s);
findResults=service.FindItems(WellKnownFolderName.Calendar、sfSearchFilter、view);
如果(findResults.TotalCount!=0)
{
Item appointment=findResults.FirstOrDefault();
任命。SetExtendedProperty(extendedPropertyDefinition,s);
...
Load(新属性集(ItemSchema.Body));
字符串strBody=appointment.Body.Text;
}
}