WinSock error occured while downloading mail message as MSG file
My environments are
Server Machine: DocuShare Server 6
Client Machine: Windows XP where DocuShare client 6, DocuShare outlook client 3, MS outlook 2007 and our C# application are installed.
We have a C# application to download mail message from DocuShare server using DocuShare API.
The application successfully downloads docushare mail messages as MSG file. But when the mail message has attachment with long name (in my case the attachment file name is "New Tzunami Outlook Attachment Extractor User Guide 20100902.docx"), the application throws Windows Socket error while downloading. If the attachment file name is short, mail messages are downloaded successfully.
Here are the codes:
private void btnDownloadMails_Click(object sender, EventArgs e)
{
MailArgument mailArg = new MailArgument();
mailArg.server = textServer.Text;
mailArg.user = textUser.Text;
mailArg.password = textPwd.Text;
DownloadMailAsMsg(mailArg);
}
void DownloadMailAsMsg(object s)
{
MailArgument mailArg = s as MailArgument;
long status = 0;
DSServerMap.Server dsserver = new DSServerMap.Server();
if (!SelectMappedServer(ref dsserver, mailArg.server))
return;
dsserver.DocuShareAddress = mailArg.server;
dsserver.UserName = mailArg.user;
dsserver.Password = mailArg.password;
dsserver.Domain = "DocuShare";
status = dsserver.Logon();
if (status == 0)
{
IItemObj objParentItem;
string[] emailHan = { "MailMessage-2919", "MailMessage-2924", "MailMessage-2925", "MailMessage-2926", "MailMessage-2926", "MailMessage-15", "MailMessage-30", "MailMessage-31" };
foreach (string handnum in emailHan)
{
objParentItem = (IItemObj)dsserver.CreateObject(handnum);
DSGATEWAYLib.IGatewayHandler gateway = (DSGATEWAYLib.IGatewayHandler)dsserver.Open();
objParentItem.AttachGateway(gateway, true);
objParentItem.Name = @"D:\emtest\" + handnum + ".msg";
int flag = objParentItem.DSDownload(0);
}
}
}
Where I stuck is at the line: int flag = objParentItem开发者_Go百科.DSDownload(0); while downloading email which have attachment file named "New Tzunami Outlook Attachment Extractor User Guide 20100902.docx". For checking, we trimmed the attachment file name to "ANew Tzunami OutAttachmen 01.docx" but we still got the same error.
The code objParentItem.DSDownload(0) return -300 value and at the same time DocuShare error dialog box pops up with following message
"Winsock error 123"
When DsAxess console is used to download the same mail message, we got the same WinSock error, so nothing can be done;).
We used WorldClient mail application for sending emails. We sent email with the attachment having "ANew Tzunami OutAttachmen 01.docx" file name using WorldCLient, which we failed to download. For the sake of tesing we used another application to send the email with the same attachment. This time we used MS word to send email with the same attachment and we succeeded downloading email using C# app and DsAxess console as well.
If you have anything about this, please share with us.
thank you. Prakash
精彩评论