Using CWS web serices the method reateSimpleDocument() return error 400 (Bad Request) when I try to upload file bigger than 750 KB .
Instead if I use CreateDocumentContext(), all works fine I can archive in CS any kind of file without size limitation.
Her below the C# code.
long sDocContext = 0;
// Store the information for the local file
ZetaLongPaths.ZlpFileInfo zfileInfo = null;
try
{
//fileInfo = new FileInfo(sDocument);
zfileInfo = new ZetaLongPaths.ZlpFileInfo(sDocument);
}
catch (Exception ex)
{
sError = "[+] " + sParent + "-" + sDocument + "-" + ex.Message;
}
// Create the DocumentManagement service client
DocumentManagementClient docManClient = new DocumentManagementClient();
// Create the OTAuthentication object and set the authentication token
OTAuthentication otAuth = new OTAuthentication();
otAuth.AuthenticationToken = sToken;
Attachment ot_Att = new Attachment();
try
{
// Create the FileAtts object to send in the upload call
ot_Att.CreatedDate = zfileInfo.CreationTime;
ot_Att.FileName = zfileInfo.Name;
ot_Att.FileSize = zfileInfo.Length;
ot_Att.ModifiedDate = zfileInfo.LastWriteTime;
//ot_Att.Contents = File.ReadAllBytes(sDocument);
ot_Att.Contents = zfileInfo.ReadAllBytes();
sMessage += "[+] FileSize =" + zfileInfo.Length + Environment.NewLine + "[+] CreatedDate =" + zfileInfo.CreationTime + Environment.NewLine + "[+] Name =" + zfileInfo.Name + "[+] LastWriteTime =" + zfileInfo.LastWriteTime + Environment.NewLine + Environment.NewLine;
sMessage += "[+] sParent =>" + sParent + "<=" + Environment.NewLine;
// *****************************************************************************************************
sDocContext = docManClient.CreateSimpleDocument(ref otAuth, sParent, zfileInfo.Name, ot_Att);
// *****************************************************************************************************
sMessage = " [+] Context ID created:" + sDocContext.ToString() + Environment.NewLine;
return sDocContext.ToString();
}