The Following Code display Failed to Clone Object {0} error. While uploading a document from a local system via C#.NET Code.
Actually I tested this in 7 systems 5 systems showing error. But on other two code works Correctly.
Mostly tested in Win 7, Server 2008R2.
By putting try Catch i identified, the error takes place in this following Line
doc.Save(RefreshMode.Refresh);
i have posted the Exception code below.
If you have idea about it.. post back.
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");
}
Exception 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()
Exception 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)
We have the same issue, putting FileNETApi.dll in the GAC solved it.