Recursive/traversal search of items using EWS managed API in subfolders too
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
2
down vote
favorite
I would like to know if there's a more efficient way of querying items than this (that works, though):
Imports Microsoft.Exchange.WebServices
Public Class ExchangeTools
Private Shared Function Items(
target_folder As Data.Folder,
Optional recurse As Boolean = False,
Optional querystring As String = Nothing
) As IEnumerable(Of Data.EmailMessage)
Dim retvar As IEnumerable(Of Data.EmailMessage)
Dim iview = New Data.ItemView(Integer.MaxValue)
If String.IsNullOrWhiteSpace(querystring) Then
retvar = target_folder.FindItems(iview).OfType(Of Data.EmailMessage)
Else
retvar = target_folder.FindItems(querystring, iview).OfType(Of Data.EmailMessage)
End If
If recurse Then
Dim fview = New Data.FolderView(Integer.MaxValue)
retvar = retvar.Concat(
target_folder.FindFolders(fview).SelectMany(
Function(sf) Items(sf, True, querystring)))
End If
Return retvar
End Function
End Class
vb.net
add a comment |Â
up vote
2
down vote
favorite
I would like to know if there's a more efficient way of querying items than this (that works, though):
Imports Microsoft.Exchange.WebServices
Public Class ExchangeTools
Private Shared Function Items(
target_folder As Data.Folder,
Optional recurse As Boolean = False,
Optional querystring As String = Nothing
) As IEnumerable(Of Data.EmailMessage)
Dim retvar As IEnumerable(Of Data.EmailMessage)
Dim iview = New Data.ItemView(Integer.MaxValue)
If String.IsNullOrWhiteSpace(querystring) Then
retvar = target_folder.FindItems(iview).OfType(Of Data.EmailMessage)
Else
retvar = target_folder.FindItems(querystring, iview).OfType(Of Data.EmailMessage)
End If
If recurse Then
Dim fview = New Data.FolderView(Integer.MaxValue)
retvar = retvar.Concat(
target_folder.FindFolders(fview).SelectMany(
Function(sf) Items(sf, True, querystring)))
End If
Return retvar
End Function
End Class
vb.net
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I would like to know if there's a more efficient way of querying items than this (that works, though):
Imports Microsoft.Exchange.WebServices
Public Class ExchangeTools
Private Shared Function Items(
target_folder As Data.Folder,
Optional recurse As Boolean = False,
Optional querystring As String = Nothing
) As IEnumerable(Of Data.EmailMessage)
Dim retvar As IEnumerable(Of Data.EmailMessage)
Dim iview = New Data.ItemView(Integer.MaxValue)
If String.IsNullOrWhiteSpace(querystring) Then
retvar = target_folder.FindItems(iview).OfType(Of Data.EmailMessage)
Else
retvar = target_folder.FindItems(querystring, iview).OfType(Of Data.EmailMessage)
End If
If recurse Then
Dim fview = New Data.FolderView(Integer.MaxValue)
retvar = retvar.Concat(
target_folder.FindFolders(fview).SelectMany(
Function(sf) Items(sf, True, querystring)))
End If
Return retvar
End Function
End Class
vb.net
I would like to know if there's a more efficient way of querying items than this (that works, though):
Imports Microsoft.Exchange.WebServices
Public Class ExchangeTools
Private Shared Function Items(
target_folder As Data.Folder,
Optional recurse As Boolean = False,
Optional querystring As String = Nothing
) As IEnumerable(Of Data.EmailMessage)
Dim retvar As IEnumerable(Of Data.EmailMessage)
Dim iview = New Data.ItemView(Integer.MaxValue)
If String.IsNullOrWhiteSpace(querystring) Then
retvar = target_folder.FindItems(iview).OfType(Of Data.EmailMessage)
Else
retvar = target_folder.FindItems(querystring, iview).OfType(Of Data.EmailMessage)
End If
If recurse Then
Dim fview = New Data.FolderView(Integer.MaxValue)
retvar = retvar.Concat(
target_folder.FindFolders(fview).SelectMany(
Function(sf) Items(sf, True, querystring)))
End If
Return retvar
End Function
End Class
vb.net
edited Apr 28 at 0:32
Jamalâ¦
30.1k11114225
30.1k11114225
asked Apr 27 at 23:48
VBobCat
1656
1656
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f193121%2frecursive-traversal-search-of-items-using-ews-managed-api-in-subfolders-too%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password