11-30-2023 01:23 PM
Good Afternoon -
I'm just wondering if it would be possible to edit a CSV via the API inside of OnBase. I know I can export the CSV file, edit it via either with System.IO or an office library. I just wanted to know if I can do this without having to export, make changes, and reimport into OnBase.
We are currently on EP3, and using the Unity API
11-30-2023 01:39 PM
It's certainly doable. The basic process would be:
Update: Sorry - I just realized that you asked "without re-importing."
The answer to that is no. Once you modify the file, you do have to re-import, but you can do the re-import automatically via the API.
12-03-2023 06:53 PM
Christopher, you could retrieve the PageData to a MemoryStream, manipulate that, and then save the MemoryStream using app.Core.Storage.StoreNewRevision(..) or using al alternative method according to how you want to store the revised document. The attached snippet demonstrates working with MemoryStream by taking a document, converting it to PDF and saving it as a rendition of the current document, all without saving to and reading back from disk.
using (PageData pageData = app.Core.Retrieval.PDF.GetDocument(args.Document.DefaultRenditionOfLatestRevision)){ using (MemoryStream memoryStream = new MemoryStream()) { pageData.Stream.CopyTo(memoryStream); memoryStream.Position = 0L; // rewind the stream StoreRenditionProperties rpPDF = app.Core.Storage.CreateStoreRenditionProperties(args.Document.LatestRevision, pdfType); using (PageData pageDataPDF = app.Core.Storage.CreatePageData(memoryStream, pdfType.Extension)) { PageData[] newPageData = new PageData[1]; newPageData[0] = pageDataPDF; Document pdfDoc = app.Core.Storage.StoreNewRendition(newPageData, rpPDF); } }}
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.