1

I'm redesigning a tool that uses EWS (Exchange Webservice). All functionalitiets should be available in the GraphServiceClient but there is 1 small piece of code I can't figure out:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1)
            {
                Url = new Uri(_options.URL),
                UseDefaultCredentials = false,
                Credentials = new WebCredentials(_options.Username, _options.Password),
                Timeout = 300000
            };
    service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, mailbox);

    Folder root = Folder.Bind(service, WellKnownFolderName.MsgFolderRoot);

    SearchFilter filter = new SearchFilter.IsEqualTo(FolderSchema.DisplayName, _options.Foldername);
    FolderView view = new FolderView(1000);
    view.PropertySet = new PropertySet(BasePropertySet.IdOnly, FolderSchema.DisplayName);

    var result = root.FindFolders(filter, view).Select(f => f as Folder).FirstOrDefault();

    return result;

All this code does is search for a folder with a specific name. It is a folder which contains company contacts but it is not declared as a contactsFolder.

I've tried searching (recursive) the contactsfolders and the mailfolders with the graphServiceClient but I can't find any folder with that name.

When I create a new contactFolder via graphServiceClient the result is that I'm seeing 2 exactly the same folders in Outlook. So why can't I find the original folder?

Berrepoot
  • 141
  • 10

0 Answers0