-
Notifications
You must be signed in to change notification settings - Fork 321
/
Copy pathMSFTTenantMediaSetAPI.Page.al
90 lines (80 loc) · 2.34 KB
/
MSFTTenantMediaSetAPI.Page.al
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
page 58213 MSFTTenantMediaSetAPI
{
PageType = API;
ApplicationArea = All;
UsageCategory = Administration;
SourceTable = "Tenant Media Set";
EntityName = 'tenantMediaSet';
EntitySetName = 'tenantMediaSet';
APIPublisher = 'MSFT';
APIGroup = 'moveData';
APIVersion = 'v1.0';
DelayedInsert = true;
Permissions = tabledata "Tenant Media Set" = rmid;
layout
{
area(Content)
{
repeater(TenantMedia)
{
field(id; Rec.ID)
{
Caption = 'id';
}
field(mediaID; Rec."Media Index")
{
Caption = 'Media Index';
}
field(base64ContentTxt; Base64ContentTxt)
{
Caption = 'Base64ContentTxt';
}
field(companyName; Rec."Company Name")
{
Caption = 'Company Name';
TableRelation = Company.Name;
}
}
}
}
trigger OnInsertRecord(BelowxRec: Boolean): Boolean
begin
SetBase64Text();
Rec.Insert();
exit(false);
end;
trigger OnAfterGetRecord()
begin
GetBase64Text();
end;
local procedure GetBase64Text()
var
Base64Convert: Codeunit "Base64 Convert";
ContentInStream: InStream;
ContentOutStream: OutStream;
TempBlob: Codeunit "Temp Blob";
begin
Clear(Base64ContentTxt);
Rec.CalcFields("Media ID");
if not Rec."Media ID".HasValue() then
exit;
TempBlob.CreateOutStream(ContentOutStream);
Rec."Media ID".ExportStream(ContentOutStream);
TempBlob.CreateInStream(ContentInStream);
Base64ContentTxt := Base64Convert.ToBase64(ContentInStream);
end;
local procedure SetBase64Text()
var
Base64Convert: Codeunit "Base64 Convert";
ContentInStream: InStream;
ContentOutStream: OutStream;
TempBlob: Codeunit "Temp Blob";
begin
TempBlob.CreateOutStream(ContentOutStream);
Base64Convert.FromBase64(Base64ContentTxt, ContentOutStream);
TempBlob.CreateInStream(ContentInStream);
Rec."Media ID".ImportStream(ContentInStream, '');
end;
var
Base64ContentTxt: text;
}