Rules & Alerts - Developing an Alerts Web Service that Uses Outlook 2003 Alerts

From: Andrew Denler (adenler_at_community.nospam)
Date: 01/26/05


Date: Wed, 26 Jan 2005 16:13:08 -0500

Referring to document
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ol2003_ta/html/odc_olalertswebservice.asp, I
have tried to set up the sample code for a web service for an outlook alert.

I have had little success so far. The web service compiles correctly, but
the code to send the alert email using CDO (see below) fails on "Send":

            MailMessage Message = new MailMessage();
            Message.To = emailAddr;
            Message.From =
ConfigurationSettings.AppSettings["senderEmailAddr"];
            Message.Subject = "You have successfully created an alert for "
+ URL + ".";
            Message.Headers.Add("X-AlertWebUrl",
ConfigurationSettings.AppSettings["alertweburl"]);
            Message.Headers.Add("X-AlertTitle",AlertTitle);
            string msgId = "<" + msgPrefix + (msgIdCounter++).ToString() +
"@microsoft.com>";
            Message.Headers.Add("message-id",msgId);

Message.Headers.Add("X-AlertId","{D32A01E6-8A46-41BF-8E0E-936F254ACA4A}");
            Message.Headers.Add("X-AlertServerType","Third Party");

Message.Headers.Add("X-AlertWebSoap",ConfigurationSettings.AppSettings["webs
erviceurl"]);

            Message.Body = "Hello, " + username + ".\n\n" + msgBody + URL +
".\n\n- RSS Sample
Web Service";
            try
            {
               SmtpMail.SmtpServer =
ConfigurationSettings.AppSettings["smtpserver"];
               SmtpMail.Send(Message);
            }
            catch(System.Web.HttpException ehttp)
            {
               return AddAlertErrorType.HttpException;
            }

The error I get is "System.Runtime.InteropServices.COMException: Fields
update failed. For further information, examine the Status property of
individual field objects." It is specifically as a result of the Message-ID
header because, if I comment out that line, the code works. Of course,
without that line, the email is delivered, but no alert is created.

Any thoughts?



Relevant Pages

  • Re: can i create a reminder to pop up in excel 5 days before?
    ... Sample code: ... but that will change to ALERT a set number of days ... monitored cell would be: ... whatever font or background color you want. ...
    (microsoft.public.excel.misc)
  • Re: HTML AJAX to DOT.NET in Different Domain
    ... The web service is called correctly from an .aspx page with ... ... Request("POST", ... alert("Browser does not support all application features." ... Thom Little www.tlanet.net Thom Little Associates, ...
    (microsoft.public.dotnet.framework)
  • Re: [PHP] Javascript and $_POST
    ... alert("Please enter a phone number." ... Although it's JS:) The sample code you posted was broken in some ... in JS en missing input field to check. ...
    (php.general)
  • WSDL & .NET Web Service
    ... (Newbie Alert!!) ... Is there a way to generate a Web Service from a WSDL file? ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • How to have .net code call pager or phone
    ... I need to code in a web service call a pager and/or a phone and leave a ... automated message as an alert when certain events occur. ...
    (microsoft.public.dotnet.languages.vb)