private VVRuntime.VisualVault.Library.Documents.Document CreateDocumentInFolder(string fileNameAndPath, string fileName, string revision, VVRuntime.VisualVault.Library.Documents.DocumentState documentState, string docID, string description)
        {
            VVRuntime.VisualVault.Library.Documents.Document document = null;

            if (_selectedFolder != null)
            {
                System.IO.FileStream fs = System.IO.File.Open(fileNameAndPath, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                //document is created by calling the NewDocument method on the target VisualVault folder
                document = _selectedFolder.NewDocument(this, docID, description, revision, fs, fileName, documentState);

                fs.Close();
            }

            return(document);
        }
        private void BtnCheckInNewClick(object sender, EventArgs e)
        {
            // This example checks in a new document using a file stream.
            // A progress bar is incremented using the chunking interface.
            // All files are transferred in chunks for efficiently sending large files.
            // The chunking interface is optional and only used to provide status.
            // A byte array could also be used.

            if (_selectedFolder != null)
            {
                if (txtNewDocumentFilePath.Text.Length > 0)
                {
                    //get the file name from the selected file path
                    var fileName  = txtNewDocumentFilePath.Text.Replace("\\", "/");
                    var sFileName = fileName.Split('/');
                    fileName = sFileName[sFileName.Length - 1];

                    //In this example we use the file name for the file name, document ID, and description values.
                    //You can specify a document ID.  However, if the target VisualVault folder has a naming convention configured
                    //then the naming convention rules will determine what value is assigned to the Document ID

                    _selectedDocument = CreateDocumentInFolder(txtNewDocumentFilePath.Text, fileName, "1", VVRuntime.VisualVault.Library.Documents.DocumentState.Released, fileName, fileName);

                    if (_selectedDocument != null)
                    {
                        MessageBox.Show(string.Format("Document {0} created", _selectedDocument.DocID), "Document Created");
                    }
                }
                else
                {
                    MessageBox.Show("Please select a file to check-in");
                }
            }
            else
            {
                MessageBox.Show("Please select a target VisualVault folder");
            }
        }
Esempio n. 3
0
 private string buildDocumentLink(VVRuntime.VisualVault.Library.Documents.Document document)
 {
     return(string.Format("{0}ViewFile.aspx?DlId={1}", _vault.VaultConfiguration.RoutedContentBase, document.DlID));
 }