Skip to content

Commit 8c3a9b0

Browse files
Add namespace and using directives to AL code examples in email extension doc
1 parent 9148534 commit 8c3a9b0

1 file changed

Lines changed: 58 additions & 1 deletion

File tree

dev-itpro/developer/devenv-extending-email.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ The following diagram shows the relationship between the objects for email scena
4444
The following code example shows how to extend the `Email Scenario` enum by adding a new scenario named **BC LE Scenario**. After you extend the enum, the new BC LE option is available in the Email Scenario field. You can assign the scenario to accounts on the **Email Scenarios** page, or by using the `EmailScenario.SetEmailAccount()` method.
4545

4646
```al
47+
namespace MyCompany.EmailExtension;
48+
49+
using System.Email;
50+
4751
enumextension 50100 BCLEScenario extends "Email Scenario"​
4852
{​
4953
value(999888; BCLEScenario)​
@@ -54,6 +58,10 @@ enumextension 50100 BCLEScenario extends "Email Scenario"​
5458
```
5559

5660
```al
61+
namespace MyCompany.EmailExtension;
62+
63+
using System.Email;
64+
5765
procedure AddEmailToScenario(Rec: Record "Email Account")
5866
var
5967
EmailScenario: Codeunit "Email Scenario";
@@ -74,6 +82,10 @@ The email address book lookup is what you use to choose email accounts in [!INCL
7482
The following code example shows how to extend the `Email Address Entity` enum by adding a **BCLE Entity** option. The BCLE entity has an email address that we want to be able to access.
7583

7684
```al
85+
namespace MyCompany.EmailExtension;
86+
87+
using System.Email;
88+
7789
enumextension 50110 "BCLE - Address Book" extends "Email Address Entity"​
7890
{​
7991
value(50110; "BCLE Entity")​
@@ -91,6 +103,7 @@ After you extend the `Email Address Entity` enum, subscribe to the `OnGetSuggest
91103
The following examples show how to implement the events.
92104

93105
```al
106+
namespace System.Email;
94107
95108
[IntegrationEvent(false, false)]​
96109
internal procedure OnGetSuggestedAddresses(TableId: Integer; SystemId: Guid; var Address: Record "Email Address Lookup")​
@@ -100,6 +113,10 @@ internal procedure OnLookupAddressFromEntity(Entity: Enum "Email Address Entity"
100113
```
101114

102115
```al
116+
namespace MyCompany.EmailExtension;
117+
118+
using System.Email;
119+
103120
var
104121
NoRecordsFoundMsg: Label 'No %1 found with an email address.', Comment = '%1 Entity type';
105122
@@ -180,6 +197,8 @@ Email view policies give you control over the email messages that a user can acc
180197
The first step is to implement the `Email View Policy` interface.
181198

182199
```al
200+
namespace System.Email;
201+
183202
interface "Email View Policy"​
184203
{​
185204
procedure GetSentEmails(var SentEmails: Record "Sent Email" temporary)
@@ -196,6 +215,10 @@ interface "Email View Policy"​
196215
Next, we'll extend the `Email View Policy` enum by adding a **BE LE View Policy** option.
197216

198217
```al
218+
namespace MyCompany.EmailExtension;
219+
220+
using System.Email;
221+
199222
enumextension 50108 "BC LE View Policy" extends "Email View Policy"​
200223
{​
201224
value(50108; "BC LE View Policy")​
@@ -227,6 +250,8 @@ All email accounts use a connector, and the accounts contain the information nee
227250
The first step is to implement the `Email Connector` interface.
228251

229252
```al
253+
namespace System.Email;
254+
230255
interface "Email Connector"​
231256
{​
232257
procedure Send(EmailMessage: Codeunit "Email Message"; AccountId: Guid)
@@ -241,6 +266,11 @@ interface "Email Connector"​
241266
Next, we'll extend the `Email Connector` enum by adding an **SMTP** option.
242267

243268
```al
269+
namespace MyCompany.EmailExtension;
270+
271+
using System.Email;
272+
273+
enumextension 50200 "My Email Connectors" extends "Email Connector"
244274
{​
245275
value(2147483647; SMTP)​
246276
{​
@@ -255,8 +285,15 @@ The last step is to create a page where we can view or create an email account.
255285
> [!TIP]
256286
> If you want more details, there are several examples available on the [ALAppExtensions repository](https://github.com/microsoft/ALAppExtensions/tree/main/Apps/W1/Email%20-%20SMTP%20Connector/app). For example, the SMTP Connector is a good implementation to explore.
257287
258-
Email Importance Enum
288+
## Email importance example
289+
290+
The following example shows how to extend the email capabilities by adding an importance field to email messages. This pattern extends both the `Email Outbox` and `Sent Email` tables and their corresponding pages to expose the new field.
291+
259292
```al
293+
namespace MyCompany.EmailExtension;
294+
295+
using System.Email;
296+
260297
enum 50109 "Email Importance"
261298
{
262299
Extensible = true;
@@ -280,6 +317,10 @@ enum 50109 "Email Importance"
280317

281318
Table extensions to add a new Importance field.
282319
```al
320+
namespace MyCompany.EmailExtension;
321+
322+
using System.Email;
323+
283324
tableextension 50110 "Importance On Sent" extends "Sent Email"
284325
{
285326
fields
@@ -305,6 +346,10 @@ tableextension 50109 "Importance On Outbox" extends "Email Outbox"
305346

306347
Page extensions on the Email Editor and Email Viewer that allow the Importance field to be viewed and changed.
307348
```al
349+
namespace MyCompany.EmailExtension;
350+
351+
using System.Email;
352+
308353
pageextension 50111 "Importance On Editor" extends "Email Editor"
309354
{
310355
layout
@@ -323,6 +368,10 @@ pageextension 50111 "Importance On Editor" extends "Email Editor"
323368
```
324369

325370
```al
371+
namespace MyCompany.EmailExtension;
372+
373+
using System.Email;
374+
326375
pageextension 50103 "Importance On Email Viewer" extends "Email Viewer"
327376
{
328377
layout
@@ -342,6 +391,10 @@ pageextension 50103 "Importance On Email Viewer" extends "Email Viewer"
342391

343392
Page extensions for the Email Outbox and Sent Emails to display the Importance field.
344393
```al
394+
namespace MyCompany.EmailExtension;
395+
396+
using System.Email;
397+
345398
pageextension 50109 "Importance On Outbox" extends "Email Outbox"
346399
{
347400
layout
@@ -359,6 +412,10 @@ pageextension 50109 "Importance On Outbox" extends "Email Outbox"
359412
}
360413
```
361414
```al
415+
namespace MyCompany.EmailExtension;
416+
417+
using System.Email;
418+
362419
pageextension 50110 "Importance On Sent" extends "Sent Emails"
363420
{
364421
layout

0 commit comments

Comments
 (0)