public void AddAttachment(string name, byte[] content, string cid) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (content == null) { throw new ArgumentNullException(nameof(content)); } var id = string.IsNullOrEmpty(cid) ? Guid.NewGuid() : new Guid(cid); var file = new FileInfo(id, id + @"\" + name, null, content); _newAttachments.Add(file); _attachmentLinks.Add(id); }
public void AddAttachment(string name, byte[] content) { if (name == null) { throw new ArgumentNullException("name"); } if (content == null) { throw new ArgumentNullException("content"); } var upload = PXGraph.CreateInstance <UploadFileMaintenance>(); var file = new FileInfo(Guid.NewGuid() + @"\" + name, null, content); upload.SaveFile(file); if (file.UID == null) { throw new Exception(string.Format("Cannot save file '{0}'" + name)); } _attachments.Add(file.UID.Value); }