$Documents.New
Overview¶
Document $Documents.New ( [ title ], [ contentType ] )
Creates a new document in repository and returns a document instance.
Arguments¶
String title Title of document
String contentType Name or Id number of content type to be used.
Remarks¶
Created document is in "Draft" state and not saved until Document.Save() method is called.
Examples¶
Creating a new document with PDF file;
var doc = $Documents.NewVersion( Script.NewId(), 'My Document'); doc.Files.AddPDF( '<p>Hello</p>', 'report.pdf'); doc.CreatedBy = $WorkItem.CompletedBy; var targetFolders = ['Reports']; doc.Publish(targetFolders);