以下代码显示无法克隆对象 {0} 错误。通过 C#.NET 代码从本地系统上传文档时。
实际上,我在 7 个系统 5 个显示错误的系统中对此进行了测试。但在其他两个代码上工作正常。
主要在 Win 7、Server 2008R2 中测试。
通过将 try Catch i 确定,错误发生在以下行
doc.Save(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");
}
例外一:
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)