Hello Techies--
I am attempting to transform existing xml files to newly formatted xml files which I want to store in WorkSite. My test files seemed to do OK--with simple file names like c:\DocImport\test.1.xml (length = 22) in reality, the path + filenames extend well over 50 characters. (most filename lengths without the path attached, exceed the length of 50 )
In the program snippet below, whenever the length of fileToImport exceeds 50, the message "Invalid Profile" gets stored in the Exception e stack.
Here is the line that produces the error:
target.CheckIn(fileToImport, imCheckinDisposition.imCheckinNewDocument,
imCheckinOptions.imDontKeepCheckedOut, ref iErrs);
Is there a real lenght issue, or is something else the culprit? In either case, any advice you have to offer will be well received!;-)
------- code snippet ---------------------------------------------------------------------------------------------------------------------------
//Note: fileToImport will include the full path name of where the physical file is located, as well as the physical file name.
strFileNm will contain only the file name.
public IManDocument ImportDocToFolder(IManDocumentFolder destination, string fileToImport,
string strComment, string strfileNm)
{
IManDocument retDoc = null;
object iErrs = null;
try
{
IManDocument target = destination.Database.CreateDocument();
// -------------- Proof of Concept: Remove after testing convers. w/scott -----
// Note: useful for Proof of Concept, owner of folder/doc will not be the same in conversion
IManAdditionalProperties addProps = destination.AdditionalProperties;
if (addProps != null && addProps.Count > 0)
{
// Loop through collection to retrieve attributes for setting doc profile.
foreach (IManAdditionalProperty ap in addProps)
{
// Profile document with the attribute value stored in additional property
target.SetAttributeByID(Utility.GetAttributeIDFromFolderProfileKey(ap.Name), ap.Value);
}
target.Name = strfileNm; // Do not see this value, except in debug
target.Description = strfileNm; //Note: shows up as the name of the file.
target.Comment = strComment; // author comment in Documentum?
// ********* Check-in of First Version *************************
// Check in document to dms
target.CheckIn(fileToImport, imCheckinDisposition.imCheckinNewDocument,
imCheckinOptions.imDontKeepCheckedOut, ref iErrs);
// Add to destination folder
IManDocuments destDocs = (IManDocuments)destination.Contents;
retDoc = (IManDocument)destDocs.AddDocumentReference(target);
// Commit changes to server
destDocs.Refresh();
destination.Update();
}
return retDoc;
}
catch(Exception e)
{
//TODO: error handling logic could go here.
Utility.ReportErrors(e);
return retDoc;
}
}
}
Paula DiTallo - Middleware Architect/ .NET Developer
plditallo@metro-design-dev.com