以下代码显示克隆对象{0}失败错误。通过C#从本地系统上传文档时。NET代码。
事实上,我在7个系统中测试了这一点,5个系统显示错误。但在其他两个代码上工作正确。
主要在Win 7、Server 2008R2中测试。
通过识别try Catch i,错误发生在以下行中
文件。保存(RefreshMode.Refresh);
我已经在下面发布了异常代码。
如果你对此有想法,请发回来。
private void uploadDocument(string file)
{
MessageBox.Show("upload Doc" + file);
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
IDocument doc = null;
IObjectStore os = ce.FetchOS(config.objectstore().Trim());
//MessageBox.Show("os" + os);
doc = CEUtil.CreateDocument(true, file, os, "Document");
MessageBox.Show("After CreteDoc1");
doc = CEUtil.CreateDocument(os, "Document");
MessageBox.Show("After CreteDoc2");
doc.Properties["DocumentTitle"] = Path.GetFileName(file);
//doc.MimeType = "text/plain";
MessageBox.Show("After Create Doc Method");
try
{
doc.ContentElements = CEUtil.CreateContentElementList(file);
MessageBox.Show("Before doc.Save");
doc.Save(RefreshMode.REFRESH);
}
catch (Exception cee)
{
MessageBox.Show(cee.ToString());
}
MessageBox.Show("Save in Doc");
try
{
IReferentialContainmentRelationship rcr = CEUtil.FileContainable(os, doc, fileInFolder);
MessageBox.Show("Before 2nd Save");
rcr.Save(RefreshMode.NO_REFRESH);
}
catch (Exception EC)
{
MessageBox.Show(EC.ToString());
}
MessageBox.Show("Second Save Complted");
try
{
CEUtil.checkInDoc(doc);
}
catch (Exception EE)
{
MessageBox.Show("Mess : ChecK In : " + EE.ToString());
}
MessageBox.Show("After Check in");
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
MessageBox.Show("Document created");
}
异常1:
ExceptionCode=E_OBJECT_CLONE_FAILED Id=FNRCE0047 Class=FileNet.Api.Exception.ErrorRecord Source=FileNet.Api.Exception.EngineRuntimeException Description=Failed to clone object {0}. stackTrace= at FileNet.Apiimpl.Util.ObjectCloner.DeepCopy(Object oldObj) at FileNet.Apiimpl.Core.EngineObjectImpl.GetModifiedData()
异常2:
ExceptionCode=API_PROPERTY_NOT_IN_CACHE Id=FNRCA0024 Class=FileNet.Api.Exception.ErrorRecord Source=FileNet.Api.Exception.EngineRuntimeException Description=The Name property was not found in the properties collection. stackTrace= at FileNet.Apiimpl.Property.PropertiesImpl.get_Item(String propertyName)
我们也有同样的问题,在GAC中放入FileNETApi.dll解决了这个问题。