# O365 - Exchange

# Set up Connector

#### Setting up the connection

**1. Register app**

Log in at [https://entra.microsoft.com](https://entra.microsoft.com).

Now click on “App registrations”.

![Ein Bild, das Text, Screenshot, Software, Zahl enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/05qILszEjjTtLycb-k5ylo5au3ftaxlau-embedded-image-h7kxs8cl.png)

Then click on “All applications”.

![Ein Bild, das Text, Screenshot, Reihe, Schrift enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/YMY0hzbKPGOCbhvU-69wtl3zbo14vcjl4-embedded-image-yfeyu3rd.png)

Now create a new registration by clicking on “New registration” at the top.

![Ein Bild, das Text, Schrift, Screenshot, Reihe enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/MsReCfowE7JjMawQ-vnjwkveg3dvc01xr-embedded-image-qo51zzco.png)

1. Under “Name”: enter “DeDeSales Exchange Connector”.
2. Select the supported account types according to the environment. If there is only one instance: select “Accounts in this organisational directory only”.
3. Select redirect URL and enter “https://login.microsoftonline.com/common/oauth2/nativeclient”.
4. Click on “Register”.
 

![i4wW1yPbAhAc7lUl-embedded-image-ogn0cn4r.png](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/na2KbcwIEpNsxWeB-i4ww1ypbahac7lul-embedded-image-ogn0cn4r.png)

Open the newly registered app by going again to “Azure Active Directory” &gt; “App registrations” and then clicking on “DeDeSales Exchange Connector”.

![Ein Bild, das Text, Screenshot, Schrift, Reihe enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/pnALxvFUJNQ2ksou-eeqncwtmufzun81w-embedded-image-ytbxsuxl.png)

1. Provide us with the Application ID.
2. Provide us with the Directory ID.
 

![jIfawHAM96I3MMmR-embedded-image-3g080sw1.png](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/UFYVcBV5rJ9cmRoD-jifawham96i3mmmr-embedded-image-3g080sw1.png)

Enter “DeDeSales Exchange Connector” under Description.

Select a Period under Valid until.

**Attention!** Before expiry, a new key must be created and communicated to us, otherwise communication will no longer be possible.

![Ein Bild, das Text, Screenshot, Schrift, Reihe enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/qrlgFCUdRyxDYuBG-adi8xitabzadozho-embedded-image-v0ysut3y.png)

Now click on Add.

Now copy the “Value” by clicking on the copy icon behind the characters.

**Attention!** This is only possible now. If you leave the page, the secret key must be created again.

Provide us with the secret key.

Click on “API permissions”.

![Ein Bild, das Text, Screenshot, Schrift enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/fEuJblmSpgEkyqNE-fxexbvfu9alrqhvr-embedded-image-qqtrzdwt.png)

Click on “Add a permission”.

![Ein Bild, das Text, Schrift, Screenshot, Reihe enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/VLpIsGDQJ2sjrTBC-kjyvxa6szqcnd0sz-embedded-image-rjidsdih.png)

Select “APIs my organisation uses”.

Then:

1. Search for and click on “Office 365 Exchange Online”.
2. Now select “Application permissions”.
 

![ANcFZZlRzFYpT8QC-embedded-image-3sgpfffa.png](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/A9FPBiEkzeeraF1l-ancfzzlrzfypt8qc-embedded-image-3sgpfffa.png)

Under “Other permissions”, select “full\_access\_as\_app”.

Click on “Add permissions”.

![Ein Bild, das Text, Screenshot, Software, Webseite enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/bRbNELlbWXK0j5Bf-hxo0bndsizba9ah8-embedded-image-pb8ksbhb.png)

Click on “Grant admin consent for …”.

![Ein Bild, das Text, Schrift, Reihe, Screenshot enthält.  KI-generierte Inhalte können fehlerhaft sein.](https://en.wiki.dedesales.de/uploads/images/gallery/2026-08/hzhQgL19zye3yEnU-n17eqlhlasozer38-embedded-image-e8tyjjpg.png)

  
Ensure that you send us the following information by different means, multiple e-mails, secure upload, etc.:

1. Application ID
2. Directory ID
3. Value from Secret client key in “Certificates &amp; secrets”
 

With this data, full access to the Exchange data has now been granted. The next section explains how to restrict access to specific user accounts.

**2. Restrict access to mailboxes**

Create a new mail-enabled security group or use an existing one.

Now create a policy for application access.

To do this, execute the following command in Powershell, replacing the arguments for AppId (=&gt; corresponds to the Application ID from the app registration) and PolicyScopeGroupId:

“New-ApplicationAccessPolicy -AppId e7e4dbfc-046f-4074-9b3b-2ae8f144f59b -PolicyScopeGroupId EvenUsers@contoso.com -AccessRight RestrictAccess -Description "Restricted access for the DeDeSales Connector."

Attention! If there are changes to user accesses, e.g. due to hiring a new Employee, then the mail-enabled security group must be extended accordingly.

#### Configuration in the DeDeSales backend

1. **Store access data**
 

Store the access data in the DeDeSales backend under Basic configuration &gt; Settings &gt; Exchange access.

1. **Configure Employee user accounts**
 

Under Basic configuration &gt; Employee, enter the E-mail address in the field “Exchange e-mail account” for each Employee. Only for Employees where this field is filled will e-mails be deducted.

Please note that these Employees must also be included in the mail-enabled security group if access has been restricted.

# Assignment of Emails to Customers

The Msg Root folder is checked directly, with known folders such as Junk, Deleted, Drafts etc. being ignored except for Inbox and SentItems.  
Thus, all user-created folders for the emails are taken into account.

If the email is in the inbox or one of its subfolders, we check the sender for a match among the contacts.

In the backend under Basic configuration \\ Settings \\ "Ignore domains during email import" domains can be entered that will be discarded.

Furthermore, under Basic configuration \\ Settings \\ "Domain matching for customers via full email" you can specify for which domains a full match should be made. These can be general addresses, such as @gmx.de or similar.

#### Rules for assignment:

1. Read recipients (TO, CC)
2. Depending on the backend settings:  
    - Exact match with the Contact =&gt; email is assigned.
    - No exact match with the Contact: The domain part of the email address is compared with the domain part of the Debtor's email 
        - If a match is found, the email is assigned
        - If no match is found, the email is ignored
3. If a match is found, the email is imported and assigned.
 

The display of Exchange emails can be found in the client under Activities.

If the Opportunities module is used, then the Exchange activity is automatically assigned to a lead/opportunity.

#### Rules for assignment: 

##### Lead

1. After determining the customer
2. Does the customer have a lead?
3. Is the status of the lead "In progress" or "Deferred"
4. Then assign the activity to the lead.
 

##### Opportunity

1. After determining the customer
2. Is the customer assigned to an opportunity?
3. Is the opportunity In progress
4. Then assign the activity to the opportunity
 

If there are multiple matches, the first one is used.

# E-Mail Attachments

The E-Mail Attachments are stored in the Documents widget.

1. At the top level, there is a folder "E-Mail Attachments"
2. Clicking on it displays folders (All E-Mail Attachments with Date Descending and the Subject of the E-Mail)
3. Same Subjects (without the prefixes before the colon in Replies and forwards) are displayed grouped. 
    - If there are multiple E-Mails with the same Subject and several Attachments, they are located in subfolders
4. The actual Files are located in the lowest folder
 

The widget is activated in the backend under &lt;Role&gt; / BASIS / customer master data / Documents.

Furthermore, the Nextcloud setting must be adjusted so that the Attachments are read from the correct directory.