Table 138 Unlinked Attachment

App
Base Application
Namespace
Microsoft.Integration.Graph
Versions
17-28

Fields, 5Keys, 2

Versions171819202122232425262728

Source29

Source in 29

src/Layers/W1/BaseApp/Integration/Graph/UnlinkedAttachment.Table.al108 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Integration.Graph;

using System.IO;

table 138 "Unlinked Attachment"
{
    Caption = 'Unlinked Attachment';
    DataClassification = CustomerContent;

    fields
    {
        field(3; "Created Date-Time"; DateTime)
        {
            Caption = 'Created Date-Time';
            ToolTip = 'Specifies when the record was created.';
        }
        field(5; "File Name"; Text[250])
        {
            Caption = 'File Name';
            ToolTip = 'Specifies the name of the record.';

            trigger OnValidate()
            var
                FileManagement: Codeunit "File Management";
                Extension: Text;
            begin
                Extension := FileManagement.GetExtension("File Name");
                case LowerCase(Extension) of
                    'jpg', 'jpeg', 'bmp', 'png', 'tiff', 'tif', 'gif':
                        Type := Type::Image;
                    'pdf':
                        Type := Type::PDF;
                    'docx', 'doc':
                        Type := Type::Word;
                    'xlsx', 'xls':
                        Type := Type::Excel;
                    'pptx', 'ppt':
                        Type := Type::PowerPoint;
                    'msg':
                        Type := Type::Email;
                    'xml':
                        Type := Type::XML;
                    else
                        Type := Type::Other;
                end;
            end;
        }
        field(6; Type; Option)
        {
            Caption = 'Type';
            ToolTip = 'Specifies the file type.';
            OptionCaption = ' ,Image,PDF,Word,Excel,PowerPoint,Email,XML,Other';
            OptionMembers = " ",Image,PDF,Word,Excel,PowerPoint,Email,XML,Other;
        }
        field(8; Content; BLOB)
        {
            Caption = 'Content';
            SubType = Bitmap;
        }
        field(8000; Id; Guid)
        {
            Caption = 'Id';
            ToolTip = 'Specifies the record ID.';
        }
    }

    keys
    {
        key(Key1; Id)
        {
            Clustered = true;
        }
        key(Key2; "Created Date-Time")
        {
        }
    }

    fieldgroups
    {
    }

    var
        CannotInsertWithNullSystemIdErr: Label 'Attempted to insert Unlinked Attachment with null SystemId. This is a programing error.', Locked = true;

    trigger OnInsert()
    var
        NullSystemIdErrorInfo: ErrorInfo;
    begin
        if not Rec.IsTemporary() then
            exit;

        if IsNullGuid(Rec.SystemId) then begin
            NullSystemIdErrorInfo.ErrorType := NullSystemIdErrorInfo.ErrorType::Internal;
            NullSystemIdErrorInfo.DataClassification := NullSystemIdErrorInfo.DataClassification::SystemMetadata;
            NullSystemIdErrorInfo.Verbosity := NullSystemIdErrorInfo.Verbosity::Error;
            NullSystemIdErrorInfo.Message := CannotInsertWithNullSystemIdErr;
            Error(NullSystemIdErrorInfo);
        end;

        Id := SystemId;
    end;
}