AttachmentAPIHelper

PHOTO EMBED

Sun Jan 21 2024 11:08:23 GMT+0000 (Coordinated Universal Time)

Saved by @MinaTimo

public class NW_AttachmentAPIHelper
{
    public static void AttachFileFromAPI(Filename _fileName , str _attachment , TableId _tableID , Recid _recid)
    {
        System.Byte[]    reportBytes = new System.Byte[0]();
        reportBytes = System.Convert::FromBase64String(_attachment);
        System.IO.Stream      stream = new System.IO.MemoryStream(reportBytes);
        DocumentManagement::attachFile(_tableID, _recid, curExt(),  DocuType::typeFile(),stream,
            System.IO.Path::GetFileName(_fileName),
            System.Web.MimeMapping::GetMimeMapping(_fileName),
            System.IO.Path::GetFileNameWithoutExtension(_fileName));
    }

}
content_copyCOPY