CmisSync.Lib.Cmis.ConvenienceExtenders.CmisConvenienceExtenders.SetContent C# (CSharp) Метод

SetContent() публичный статический Метод

Sets the content stream of the document.
public static SetContent ( this doc, string content, bool overwrite = true, bool refresh = true ) : IObjectId
doc this Remote document.
content string New content as string.
overwrite bool If set to true overwrites existing content.
refresh bool If set to true refreshs the original remote doc instance.
Результат IObjectId
        public static IObjectId SetContent(this IDocument doc, string content, bool overwrite = true, bool refresh = true) {
            ContentStream contentStream = new ContentStream();
            contentStream.FileName = doc.Name;
            contentStream.MimeType = MimeType.GetMIMEType(doc.Name);
            byte[] c = Encoding.UTF8.GetBytes(content);
            contentStream.Length = c.LongLength;
            using (var stream = new MemoryStream(c)) {
                contentStream.Stream = stream;
                return doc.SetContentStream(contentStream, overwrite, refresh);
            }
        }