Click here to Skip to main content
15,921,941 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Cancelling the META REFRESH timer Pin
Paul Watson5-Aug-05 0:49
sitebuilderPaul Watson5-Aug-05 0:49 
Generalasp.net events Pin
wpcolleen4-Aug-05 0:16
wpcolleen4-Aug-05 0:16 
QuestionASP.NET & System.Diagnostics.Debug.WriteLine ? Pin
Jon Hulatt3-Aug-05 23:22
Jon Hulatt3-Aug-05 23:22 
GeneralAsp SourceCode Management Tool Pin
Paul Sun3-Aug-05 21:28
Paul Sun3-Aug-05 21:28 
GeneralRe: Asp SourceCode Management Tool Pin
Paul Sun3-Aug-05 21:51
Paul Sun3-Aug-05 21:51 
GeneralRe: Asp SourceCode Management Tool Pin
enjoycrack3-Aug-05 23:53
enjoycrack3-Aug-05 23:53 
GeneralRe: Asp SourceCode Management Tool Pin
Paul Sun4-Aug-05 15:17
Paul Sun4-Aug-05 15:17 
GeneralASP.NET/C#/CDO COMException.. PLEASE HELP! Pin
Jonathan W. Zaleski3-Aug-05 11:22
Jonathan W. Zaleski3-Aug-05 11:22 
I am attempting to send a message using CDO in a ASP.NET/C# Application:

I receive the following Error when trying to update the fields:

////////////////////////////////////////////

ERROR

////////////////////////////////////////////

Fields update failed. For further information, examine the Status property of individual field objects.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Fields update failed. For further information, examine the Status property of individual field objects.

////////////////////////////////////////////

The code looks like the following:

////////////////////////////////////////////


//// CLASS VARIABLES
static private String _currStoreName = "My";
static StoreClass _oCurrStore;

const string CDO_MailServer = "mail.dovetailinternet.com";
const string CDO_ContentDisposition = "attachment;filename=smime.p7m";
const int CDO_SmtpPort = 25;
const int CDO_SendUsingType = 2;

private Certificates oCerts;
private Certificate oCert;

private EnvelopedData oEnvData;



////METHODS

private void CDOMail()
{
CDO.Configuration mailerConfig = new CDO.ConfigurationClass();
CDO.IMessage firstMsg = new CDO.MessageClass();
CDO.IMessage secondMsg = new CDO.MessageClass();

mailerConfig.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value = CDO_SendUsingType;
mailerConfig.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = CDO_MailServer;
mailerConfig.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value = CDO_SmtpPort;
mailerConfig.Fields.Update();

firstMsg.Sender = "from@internet.com";
firstMsg.To = "to@internet.com";
firstMsg.Subject = "First Message Subject";
firstMsg.TextBody = "Message One Body";

secondMsg.DataSource.OpenObject(firstMsg, "IMessage");

CDO.IBodyPart oBodyPart = secondMsg.BodyPart;
oBodyPart.ContentMediaType = "application/pkcs7-mime;smime-type=enveloped-data;name=smime.p7m;";
oBodyPart.ContentTransferEncoding = "base64";

//*** Update That Fails
oBodyPart.Fields["urn:schemas:mailheader:content-disposition"].Value = CDO_ContentDisposition;
oBodyPart.Fields.Update();
//***

secondMsg = EnvelopeMessage(secondMsg);
secondMsg.Configuration = mailerConfig;
secondMsg.Send();
}

//// ENVELOPMESSAGE

private CDO.IMessage EnvelopeMessage(CDO.IMessage msg)
{
CDO.Message oSecMsg = new CDO.MessageClass();

oSecMsg.DataSource.OpenObject(msg, "IMessage");

_oCurrStore = new StoreClass();
_oCurrStore.Open(CAPICOM_STORE_LOCATION.CAPICOM_CURRENT_USER_STORE, _currStoreName,CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_EXISTING_ONLY | CAPICOM_STORE_OPEN_MODE.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED);

oCerts = (Certificates)_oCurrStore.Certificates;

foreach(Certificate cert in oCerts)
{
oCert = cert;
}

CAPICOM.EnvelopedData oEnvData = new CAPICOM.EnvelopedDataClass();
oEnvData.Recipients.Add(oCert);

ADODB.Stream tmpStream = oSecMsg.BodyPart.GetStream();
string strContent = tmpStream.ReadText(tmpStream.Size);
oEnvData.Content = strContent;

string strData = oEnvData.Encrypt(CAPICOM.CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64);

ADODB.Stream oStream = oSecMsg.BodyPart.GetDecodedContentStream();
oStream.Type = ADODB.StreamTypeEnum.adTypeBinary;

byte[] byteData = Convert.FromBase64String(strData);

oStream.Write(byteData);
oStream.Flush();
oStream.Close();

return oSecMsg;
}



Any help would be greatly appreciated, i've been trying to resolve the issue for hours on end, and know that eliminating this error will likely yield the desired effect.

I have been unable to find any good examples of sending CDO.Mail with .NET except the one here:

http://support.microsoft.com/Default.aspx?kbid=280391

I Followed the Instructions and am now faced with this problem. Please Help me!
GeneralOn Closing a Browser Window... Pin
SABhatti3-Aug-05 4:05
SABhatti3-Aug-05 4:05 
GeneralRe: On Closing a Browser Window... Pin
Guffa3-Aug-05 5:34
Guffa3-Aug-05 5:34 
GeneralRe: On Closing a Browser Window... Pin
SABhatti3-Aug-05 6:29
SABhatti3-Aug-05 6:29 
GeneralUsing ActiveX component in a web page Pin
Spaz803-Aug-05 0:51
Spaz803-Aug-05 0:51 
GeneralRe: Using ActiveX component in a web page Pin
Pradyumna Gogte5-Aug-05 3:20
Pradyumna Gogte5-Aug-05 3:20 
GeneralNewbie Here Pin
Ethel038@aol.com2-Aug-05 19:56
Ethel038@aol.com2-Aug-05 19:56 
GeneralRe: Newbie Here Pin
Christian Graus2-Aug-05 20:06
protectorChristian Graus2-Aug-05 20:06 
GeneralRe: Newbie Here Pin
Vasudevan Deepak Kumar5-Aug-05 5:29
Vasudevan Deepak Kumar5-Aug-05 5:29 
GeneralJavascript & Coldfusion Pin
walkerst2-Aug-05 17:56
walkerst2-Aug-05 17:56 
GeneralRe: Javascript & Coldfusion Pin
Member 5569024-Aug-05 2:03
Member 5569024-Aug-05 2:03 
GeneralJavascript in ASP.net Pin
Dotnetdeveloper062-Aug-05 13:12
Dotnetdeveloper062-Aug-05 13:12 
QuestionJavascript size limit? Pin
Christer Claesson2-Aug-05 9:35
Christer Claesson2-Aug-05 9:35 
AnswerRe: Javascript size limit? Pin
Guffa2-Aug-05 9:57
Guffa2-Aug-05 9:57 
Questionwhat is a multiplexing server? Pin
ThinkingPrometheus2-Aug-05 2:39
ThinkingPrometheus2-Aug-05 2:39 
GeneralAdding to a table using Javascript Pin
totig2-Aug-05 2:01
totig2-Aug-05 2:01 
GeneralRe: Adding to a table using Javascript Pin
enjoycrack2-Aug-05 16:23
enjoycrack2-Aug-05 16:23 
GeneralJavascript question Pin
AlphonseElric1-Aug-05 23:25
AlphonseElric1-Aug-05 23:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.