Hi,
Please assist. I need to be able to upload a new file to a newly created document in eB using C#.
I noticed the eB.ContentData.File class. Can I use this?
If possible please provide some code snippets or a sample C# project solution.
Regards
JS
Note, i'm using v15.5.1
Hi Jemaine,
Yes, you can use eB.ContentData.file class for upload in v15.5.1.
Answer Verified By: Jemaine Shezi
Jemaine,Please check the below Snippet. I hope it would be of any help:
eB.Data.Document eBDoc = new eB.Data.Document(_ses, docID);eBDoc.Retrieve("Header;Files");eB.Data.File nf = new eB.Data.File(_ses);eB.ContentData.File cf = new eB.ContentData.File(nf, txtFileName, eB.ContentData.File.FileOperation.Upload);nf.ContentData = cf;nf.Document = eBDoc;nf.Save();eBDoc.Save();
Hi Manav,
Many thanks. This works well.
Happy to help. Have a Great day!
One last question.
For downloading a file I've used:
eB.ContentData.File f = new eB.ContentData.File(file, filePath, eB.ContentData.File.FileOperation.Download,eB.ContentData.File.ReadOptions.AlwaysOverwrite, eB.ContentData.File.WriteOptions.ExternalLink);
f.WriteAllBytes();
f.Close();
What is the function of eB.ContentData.File.WriteOptions?
Jemaine,Here is the option in Core:
public enum WriteOptions { /// <publish type="Internal"/> /// <summary>Copies files from the source destination in chunks.</summary> CopyBlobs = 0, /// <publish type="Internal"/> /// <summary>Adds a file directly from a URL.</summary> CopyURL = 1, /// <publish type="Internal"/> /// <summary>Adds a file directly from a URL, then deletes the existing file from the source URL</summary> MoveURL = 2, /// <publish type="Internal"/> /// <summary>Creates a link between an external file and an object, the file is never copied into the system.</summary>
ExternalLink = 3 }