Exemple #1
0
        public static ContentService.FileAtts createFileAtts(Record record, int length)
        {
            ContentService.FileAtts fileAtts = new ContentService.FileAtts();
            fileAtts.CreatedDate = DateTime.Now;
            fileAtts.FileName = Utils.replaceFileExtension(record.fileName, ".pdf");
            fileAtts.FileSize = length;
            fileAtts.ModifiedDate = DateTime.Now;

            return fileAtts;
        }
Exemple #2
0
        public static ContentService.FileAtts createFileAtts(Record record, int length)
        {
            ContentService.FileAtts fileAtts = new ContentService.FileAtts();
            fileAtts.CreatedDate  = DateTime.Now;
            fileAtts.FileName     = Utils.replaceFileExtension(record.fileName, ".pdf");
            fileAtts.FileSize     = length;
            fileAtts.ModifiedDate = DateTime.Now;

            return(fileAtts);
        }
Exemple #3
0
        internal bool addVersion(Record record, string contextId, byte[] content, int targetObjectId)
        {
            ContentService.ContentServiceClient contentClient = new ContentService.ContentServiceClient();
            ContentService.OTAuthentication     contentOTAuth = new ContentService.OTAuthentication();
            contentOTAuth.AuthenticationToken = getAuthToken();

            ContentService.FileAtts fileAtts = Utils.createFileAtts(record, content.Length);
            byte[] recognizedContent         = content;
            using (Stream stream = new MemoryStream(recognizedContent))
            {
                try
                {
                    string objectId = contentClient.UploadContent(ref contentOTAuth, contextId, fileAtts, stream);
                    return(true);
                }
                catch (Exception e)
                {
                    log.Error(e, "Exception in method 'addVersion' while trying to add version for object: {0}", new object[] { targetObjectId });
                    return(false);
                }
            }
        }