Anybody know, how can I find out the Name of Inbox-Email Folder in Exchange Web Server (EWS) using vb.net. Depending the local porperties it can be named "Inbox" (engl.), "Posteingang" (german), etc
Thx
Anybody know, how can I find out the Name of Inbox-Email Folder in Exchange Web Server (EWS) using vb.net. Depending the local porperties it can be named "Inbox" (engl.), "Posteingang" (german), etc
Thx
You can use the following code to get it:
ExchangeService server = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
server.UseDefaultCredentials = true;
string configUrl = @"https://yourServerAddress.asmx";
server.Url = new Uri(configUrl);
//SetView
FolderView view = new FolderView(100);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
view.PropertySet.Add(FolderSchema.DisplayName);
view.Traversal = FolderTraversal.Deep;
FindFoldersResults findFolderResults = server.FindFolders(WellKnownFolderName.Root, view);
//find specific folder
foreach(Folder f in findFolderResults)
{
//show folderId of the folder "test"
if (f.DisplayName == "Test")
Console.WriteLine(f.Id);
}
Related link:Exchange Web Service FolderId for a not well known folder name
You should use the WellKnownFolderName
enum for that if you only want to access the folder no matter what the name is. If you really need to know the name, open the folder using WellKnownFolderName
, then retrieve the DisplayName
attribute.
Based on your suggestions I found finally the solution for me:
Dim strFolderName As String
strFolderName = Folder.Bind(objExchange,WellKnownFolderName.Inbox).DisplayName.ToString