Created
June 24, 2019 13:00
-
-
Save eeskildsen/e928472d11ba4723440e763ab5eb8b59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Folder FindFolderByDisplayName(ExchangeService service, string name) | |
{ | |
var folderView = new FolderView(100); | |
folderView.PropertySet = new PropertySet(BasePropertySet.IdOnly); | |
folderView.PropertySet.Add(FolderSchema.DisplayName); | |
folderView.Traversal = FolderTraversal.Deep; | |
FindFoldersResults findFolderResults = service.FindFolders(WellKnownFolderName.Root, folderView); | |
return findFolderResults | |
.Cast<Folder>() | |
.FirstOrDefault(folder => folder.DisplayName == name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, thanks for this!
Three additions for anyone who comes after me:
Result: