在VB.NET中上载FileNet文件



我正在尝试将文件上传到特定的FileNet文件夹,此代码只创建一个空的pdf文档。有什么帮助吗?

Dim folder As IFolder = Factory.Folder.GetInstance(os, ClassNames.FOLDER, New Id(IdS))
Dim doc As IDocument = Factory.Document.CreateInstance(os, ClassNames.DOCUMENT, Nothing)
doc.Properties("DocumentTitle") = "Test110"
doc.MimeType = "application/pdf"
doc.Save(RefreshMode.NO_REFRESH)
Dim rcr As IReferentialContainmentRelationship = folder.File(doc, AutoUniqueName.AUTO_UNIQUE, "Test", DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE)
rcr.Save(RefreshMode.NO_REFRESH)

您需要将内容元素添加到文档中。

C#示例:

// Specify internal and external files to be added as content.
Stream internalFile = File.OpenRead(@"C:\BootstrapConfigUtility.bat");
String externalFile = "file://C:\BootstrapConfigUtility.bat";
// Add content to the Reservation object.
try {
// First, add a ContentTransfer object.
IContentTransfer ctObject = Factory.ContentTransfer.CreateInstance();
IContentElementList contentList = Factory.ContentTransfer.CreateList();
ctObject.SetCaptureSource(internalFile);
// Add ContentTransfer object to list.
contentList.Add(ctObject);
// Second, add a ContentReference object.
IContentReference crObject = Factory.ContentReference.CreateInstance(os);
crObject.ContentLocation = externalFile;
crObject.ContentType = "text/plain";// Must be set for ContentReference.
// Add ContentReference object to list.
contentList.Add(crObject);
doc.ContentElements = contentList;
doc.Save(RefreshMode.REFRESH);
}
catch (Exception e)
{
System.Console.WriteLine(e.Message);
}

请参阅:https://www.ibm.com/docs/en/filenet-p8-platform/5.2.0?topic=documents-工作#document_procedures_doc_procedures_create

相关内容

  • 没有找到相关文章

最新更新