SYNC_MODE = 2
SYNC_MODE = 2: Build Azure AD Groups
One or more groups with different settings can be created as Azure AD groups. To achieve this, a group object must be added with the appropriate parameters.
Group initialization is done by adding a dictionary entry in the following format:
GroupsDict.Add("M365Group_FaxUsers", new Group
(syncGroupOwners:true,syncM2F:true,syncM2F_wFN:true,syncF2M:true,syncF2M_fwd:
true,params_Header:new string[]{“givenName”,”department”},header:"AnyHeaderYouWant",
params_Coversheet:new string[]{"givenName","surname","department","postalCode"},
faxNumberField:"faxNumber",add_countrycode:false, countrycode:"55",
extension_length:0,extension_prefix:"",id_Azure:""));
Key (datatype: string): Entra Admin Center Group Name
Value (datatype: Class Group): Parameterized representation of the group
Definition of Class: Group
Parameter No. | Datatype | Parameter | Short description | More information |
---|---|---|---|---|
1 | public bool | SyncGroupOwners | Sync group owners | |
2 | public bool | SyncM2F | Sync mailboxes of this group for Email-to-Fax | |
3 | public bool | SyncM2F_wFN | [Email-to-Fax only] Sync only mailboxes of this group with a fax number entry | |
4 | public bool | SyncF2M | Sync mailboxes of this group for Fax-to-Email | |
5 | public bool | SyncF2M_fwd |
| |
6 | public string[] | Params_Header | MS GraphAPI parameters that are required for building the fax header of this group | |
7 | public string | Header | Header of this group (if can be hardcoded for the customer) | |
8 | public string[] | Params_Coversheet | MS GraphAPI parameters that are required for building the fax coversheet of this group | |
9 | public string | FaxNumberField | MS Graphi API name of the Entra Admin Center field that holds fax number /CSID information of this group | |
10 | public bool | Add_countrycode | Add countrycode to every detected fax number of this group | |
11 | public string | Countrycode | Countrycode without +, e.g. “1” for US or “49” for GER | |
12 | public int | Extension_length | Fax number block length (e.g. 4 for a 10.000 numbers block) of this groups number block | |
13 | public string | Extension_prefix | Prefix for fax numbers extension, e.g. if fax number is derived from business phone number for this group | |
14 | public string | Id_Azure | Id of the Group in MS Azure |
No. 1: SyncGroupOwners
Value | Description |
---|---|
true | Syncs the owner(s) of the group. Which services are synced and how they are synced depends on the settings for SyncM2F, SyncM2F_wFN, SyncF2M, and SyncF2M_fwd, which apply to both owners and members of a group. Depending on the permissions granted to the Microsoft Graph API function (defined in Azure Portal → Enterprise Applications → Enterprise Application → Application ID), either only M365 group owners or also owners of distribution lists and security groups can be synced. The provided sample code retrieves all group owners it is configured to fetch via the Microsoft Graph API. However, which owners can be read depends on the Microsoft Graph API capabilities and the enterprise application settings. |
false | Does not sync the owner(s) of the group. |
No. 2: SyncM2F
Value | Description |
---|---|
true | Syncs mailboxes of this group for Email-to-Fax. These may be shared mailboxes or personal mailboxes. Further configurations for Email-to-Fax are defined in SyncM2F_wFN. |
false | Do not sync mailboxes from this group for Email-to-Fax. |
No. 3: SyncM2F_wFN
This parameter is only relevant for Email-to-Fax configuration.
Do not delete this parameter, even if Email-to-Fax is not used for this group.
Value | Description |
---|---|
true | [Applicable for Email-to-Fax only] Syncs only mailboxes of this group that have a fax number entry. A fax number entry can be either alphanumeric or numeric. For more details on alphanumeric and numeric senderIDs, see Graph API dictionary table and definitions. If a fax number entry contains multiple parts (comma-separated), only the first part is used. For more details on the definition of Fax Entry, see Graph API dictionary table and definitions. |
false | Mailboxes without a fax number entry are still synced for Email-to-Fax. In this case, an empty string is synced with Retarus for the specific mailbox, meaning a higher-level CSID (client, profile, or default profile) will be used for this mailbox. |
No. 4: SyncF2M
This parameter defines whether Fax-to-Email synchronization should be enabled.
Value | Description |
---|---|
true | Synchronizes mailboxes of this group for Fax-to-Email using the fax number fields specified in FaxNumberField. If
For more details, see Fax Entry in Graph API dictionary table and definitions. |
false | Don’t sync this group's users for Fax-to-Email. |
No.5: SyncF2M_fwd
Value | Description |
---|---|
true | Mailbox for forwarding and/or single numbers, meaning one or more of the following:
For more details on the definition of Fax Entry, see Graph API dictionary table and definitions. |
false | Only single numbers, meaning one or more of the following:
➔ No forwarding numbers For more details on the definition of Fax Entry, see Graph API dictionary table and definitions. |
No. 6: Params_Header
Params_Header lists all parameters required for a user-specific fax header. It does not matter whether a parameter is also listed in Params_Coversheet.
Use Graph API notation for parameter names, not Entra Admin Center notation.
The association table is available in Graph API dictionary table and definitions.
Do not delete this entry, even if a personalized header is not required.
Examples
To include the department in the individual header:
params_Header:new string[]{"department"}
To include both the department and the given name:
params_Header:new string[]{"department", "givenName"}
If the header is static for this group, no parameter needs to be queried:
params_Header:new string[]{}
A personalized fax header can include user-specific details, such as the fax number (highlighted in yellow in the example fax). Additionally, document-dependent information like timestamps, dates, and fax page numbers can be displayed in the header.

The header can be different for group owners and members.
No. 7: Header
Header defines a static header for all members and owners of a group.
Examples
To set a static header for all group owners and members:
header:"AnyHeaderYouWant"
If a static header is not required, set an empty string:
header:""
If a personalized header is required, it must be set directly in the code, since personalization parameters (e.g., user.surname
) are only available at runtime when generating user lists (m2f.csv
).
For group synchronization (MODE=2), search for the following parameters in the code and modify/uncomment the relevant lines:
PERS_HEADER_MODE2_USERS
PERS_HEADER_MODE2_OWNERS
For further details on Retarus Email-to-Fax headers, refer to the Email-to-Fax documentation or contact your Technical Consultant or Implementation Engineer
Examples
To enable a user-specific header, modify/uncomment the following lines in the code:
For group members (PERS_HEADER_MODE2_USERS
):
// WRITE/UNCOMMENT CODE BELOW IF USER-SPECIFIC HEADER SHALL BE USED
// header = "{DateTime.Now:0f dd.MM.yyyy HH:mm %C} " + user.surname + " %r%P/%T";
For group owners (PERS_HEADER_MODE2_OWNERS
):
// WRITE/UNCOMMENT CODE BELOW IF USER-SPECIFIC HEADER SHALL BE USED
// header = "{DateTime.Now:0f dd.MM.yyyy HH:mm %C}" + " " + group_owner.surname + "%r%P/%T";
No. 8: Params_Coversheet
Defines Microsoft Graph API parameters used for the Email-to-Fax cover sheet.
Examples
If no cover sheet parameters are required for a group:
params_Coversheet:new string[]{}
If a group requires given name, surname, and department:
params_Coversheet:new string[]{"givenName", "surname", "department"}
Important Notes
Use Graph API parameter names, not Exchange Admin Center names. See Graph API dictionary table and definitions for reference.
Graph API parameters are always in lower case.
In the
m2f.csv
file, the sample code prefixes each Microsoft Graph API parameter with “s_” to distinguish between standardm2f.csv
parameters and custom parameters:Graph API Parameter:
"givenName"
Corresponding
m2f.csv
field:"s_givenName"
Cover sheet parameter handling
The sample code automatically creates a unique list of coversheet parameters across all synchronized groups. Different groups can have:
The same coversheet parameters
Different coversheet parameters
A subset of other groups’ coversheet parameters
Coversheet parameters that are not relevant for a specific group appear as empty fields in the final m2f.csv
for mailboxes in that group.
No. 9: FaxNumberField
Defines the source for the alphanumeric CSID or one or more numeric fax numbers/CSIDs.
This parameter specifies the Microsoft Graph API name of the Entra Admin Center field that contains fax number/CSID information for the group. The sample code supports fax number data from either businessPhones
or faxNumber
(see also Graph API dictionary table and definitions).
Examples
If fax number or CSID information is stored in the
businessPhones
field:faxNumberField:"businessPhones"
If fax number or CSID information is stored in the
faxNumber
field:faxNumberField:"faxNumber"
Use case: business phone as fax number source
Some setups associate a fax number with a phone number extension rather than storing it separately, for example:
Business phone:
+49 12345678 – 1234
Fax number:
+49 12345678 – 5 – 1234
In such cases, some customers may prefer to use the business phone field directly and apply the Extension_length and Extension_prefix functionalities to extract fax number information.
No. 10: Add_countrycode
Defines whether a country code is added to detected fax numbers in this group.
Value | Description |
---|---|
true | Adds the country code to all detected numeric fax numbers in this group. The system detects whether an entry is an alphanumeric CSID or a numeric CSID/fax number. A country code is not added to alphanumeric CSIDs. If a user has multiple fax numbers, each number receives the country code. In forwarding scenarios, the country code is only added to the customer’s number (B-number). The Retarus number (C-number) is predefined and already includes the country code in Azure. Fax numbers that do not already contain a country code can be written with or without a leading zero. If a leading zero is used, it will be removed, and the country code specified in Countrycode will be added. The only hardcoded exception where the leading zero is retained is when the country code is Italy (39). In Italy, leading zeros are local prefixes that must not be removed, and the country code serves as a prefix for the entire stored number. |
false | No country code is added to fax numbers of this group's mailboxes. |
No. 11: Countrycode
Defines the country code to be added to fax numbers if this feature is required. Enter the country code without “+” or “00”, e.g., "1"
for the US or "49"
for Germany.
Examples
To add the country code 55:
countrycode:"55"
To not add a country code:
countrycode:""
(not required ifadd_countrycode: false
)
Fax numbers that do not already contain a country code can be written with or without a leading zero. If a leading zero is used, it will be removed, and the country code specified in Countrycode will be added.
The only hardcoded exception where the leading zero is retained is when the country code is Italy (39). In Italy, leading zeros are local prefixes that must not be removed, and the country code serves as a prefix for the entire stored number.
No. 12: Extension_length
Defines the fax number block length for this group's number block (e.g., 4
for a block of 10,000
numbers). The sample code synchronizes:
The number block as
block-name
inf2m.csv
The extension as
extension
inf2m.csv
In forwarding scenarios, this separation applies to the C-number (Retarus forwarding number).
No. 13: Extension_prefix
Defines the prefix for fax number extensions, typically used when the fax number is derived from the business phone number for this group.
Example
If the business phone is:
+49 12345678 – 1234
And the corresponding fax number is:
+49 12345678 – 5 – 1234
Then the extension prefix is extension_prefix: "5"
.
If this functionality is not used, set extension_prefix: ""
.
No. 14: Id_Azure
Represents the Group ID in Microsoft Azure. During initialization, this value is empty and must be set asid_Azure: ""
.
The variable is populated when the Group name is listed as a GroupsDict.Key
in:
Dictionary<string,Group> GroupsDict = new Dictionary<string,Group>();
It can be found in the customer's Azure Active Directory. Every Azure Group has such an ID.
mode2_multiRecipients
Defines how fax recipients are handled in Mode 2.
Scenarios
mode2_multiRecipients = true
→ An intermediate CSV is created, and fax recipients are merged.mode2_multiRecipients = false
→ No intermediate CSV is created, and fax recipients are overwritten.
Consequence
If multiple recipients are expected for one or more fax numbers now or in the future in your Fax-to-Email implementation, set:mode2_multiRecipients: true
