-1

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

3 Answers3

0

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

Simon Li
  • 303
  • 2
  • 4
0

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.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
0

Based on your suggestions I found finally the solution for me:

Dim strFolderName As String

strFolderName = Folder.Bind(objExchange,WellKnownFolderName.Inbox).DisplayName.ToString