|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Add Categories to outbound messages using CDOWhat CDO? Is this CDO 1.21 or CDOSys or some other CDO? For anything but CDO
1.21 questions you're probably better off posting to an Exchange or Windows development group. For CDO 1.21 see Create an Outlook Contact with CDO at http://www.cdolive.com/cdo5p2.htm which shows adding category information to a contact item. If the recipient is using Outlook 2007 it's most likely that any incoming messages with categories will have the categories stripped from the messages. -- Show quoteKen Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "bnaveke" <bnav***@discussions.microsoft.com> wrote in message news:538E8A0C-E6F5-4658-86EB-EA8057D27D35@microsoft.com... > How do you add categories to messages you create and send using CDO? Thanks Ken,
Sorry, should have been more specific....CDO 1.21 I've been to http://www.cdolive.com/cdo5p2.htm Great site. However I know how to add categories programmatically for existing Outlook 2007 Items or incoming. I'm looking at outgoing message created from VB.Net. I'm creating a new CDO.message in VB.net code and want to attach categories and then send it. for example Const cdoSendUsingMethod As Object = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort As Object = 2 Const cdoSMTPServer As Object = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort As Object = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout As Object = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" Const cdoSMTPAuthenticate As Object = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoBasic As Integer = 1 Dim cdomessage As CDO.Message = New CDO.Message With cdomessage .From = "Accounting-Time" .To = "Per***@email.com" .Subject = "Missing Time Sheets" .HTMLBody = "<font size = 3>" & MessageText ' Set configuration. Dim iConfg As CDO.Configuration = New CDO.Configuration Dim oFields As ADODB.Fields oFields = iConfg.Fields Dim oField As ADODB.Field oField = oFields(cdoSendUsingMethod) oField.Value = 2 oField = oFields(cdoSMTPServer) oField.Value = "192.168.0.7" oField = oFields(cdoSMTPServerPort) oField.Value = 25 oField = oFields(cdoSMTPAuthenticate) oField.Value = 1 oField = oFields(cdoSMTPConnectionTimeout) oField.Value = 10 oFields.Update() .Configuration = iConfg .Send() cdomessage = Nothing iConfg = Nothing oFields = Nothing oField = Nothing End With cdomessage = Nothing Show quote "Ken Slovak - [MVP - Outlook]" wrote: > What CDO? Is this CDO 1.21 or CDOSys or some other CDO? For anything but CDO > 1.21 questions you're probably better off posting to an Exchange or Windows > development group. > > For CDO 1.21 see Create an Outlook Contact with CDO at > http://www.cdolive.com/cdo5p2.htm which shows adding category information to > a contact item. > > If the recipient is using Outlook 2007 it's most likely that any incoming > messages with categories will have the categories stripped from the > messages. > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com > Author: Professional Programming Outlook 2007 > Reminder Manager, Extended Reminders, Attachment Options > http://www.slovaktech.com/products.htm > > > "bnaveke" <bnav***@discussions.microsoft.com> wrote in message > news:538E8A0C-E6F5-4658-86EB-EA8057D27D35@microsoft.com... > > How do you add categories to messages you create and send using CDO? > > That doesn't look like CDO 1.21 code, which isn't supported for use in
managed code anyway. For one thing CDO 1.21 has no HTMLBody property. Are you referencing CDO.DLL?. I think you're using some other CDO. If that's the case I can't help you. -- Show quoteKen Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "bnaveke" <bnav***@discussions.microsoft.com> wrote in message news:A7560C49-F8ED-4CF8-855A-F98BA26CFB03@microsoft.com... > Thanks Ken, > > Sorry, should have been more specific....CDO 1.21 > > I've been to http://www.cdolive.com/cdo5p2.htm Great site. However I know > how to add categories programmatically for existing Outlook 2007 Items or > incoming. I'm looking at outgoing message created from VB.Net. I'm > creating a new CDO.message in VB.net code and want to attach categories > and > then send it. > > > for example > > Const cdoSendUsingMethod As Object = > "http://schemas.microsoft.com/cdo/configuration/sendusing" > Const cdoSendUsingPort As Object = 2 > Const cdoSMTPServer As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpserver" > Const cdoSMTPServerPort As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpserverport" > Const cdoSMTPConnectionTimeout As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" > Const cdoSMTPAuthenticate As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" > Const cdoBasic As Integer = 1 > > Dim cdomessage As CDO.Message = New CDO.Message > > With cdomessage > .From = "Accounting-Time" > .To = "Per***@email.com" > .Subject = "Missing Time Sheets" > .HTMLBody = "<font size = 3>" & MessageText > > ' Set configuration. > Dim iConfg As CDO.Configuration = New CDO.Configuration > > Dim oFields As ADODB.Fields > oFields = iConfg.Fields > > Dim oField As ADODB.Field > oField = oFields(cdoSendUsingMethod) > oField.Value = 2 > oField = oFields(cdoSMTPServer) > oField.Value = "192.168.0.7" > oField = oFields(cdoSMTPServerPort) > oField.Value = 25 > oField = oFields(cdoSMTPAuthenticate) > oField.Value = 1 > oField = oFields(cdoSMTPConnectionTimeout) > oField.Value = 10 > > oFields.Update() > .Configuration = iConfg > > .Send() > > cdomessage = Nothing > iConfg = Nothing > oFields = Nothing > oField = Nothing > End With > > cdomessage = Nothing Sorry, should have been more specific....CDO 1.21
I'm looking at outgoing message created from VB.Net. I'm creating a new CDO.message in VB.net code and want to attach categories and then send it. In the example below how would add categories to the CDO.message? for example Const cdoSendUsingMethod As Object = "http://schemas.microsoft.com/cdo/configuration/sendusing" Const cdoSendUsingPort As Object = 2 Const cdoSMTPServer As Object = "http://schemas.microsoft.com/cdo/configuration/smtpserver" Const cdoSMTPServerPort As Object = "http://schemas.microsoft.com/cdo/configuration/smtpserverport" Const cdoSMTPConnectionTimeout As Object = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" Const cdoSMTPAuthenticate As Object = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" Const cdoBasic As Integer = 1 Dim cdomessage As CDO.Message = New CDO.Message With cdomessage .From = "Accounting-Time" .To = "Per***@email.com" .Subject = "Missing Time Sheets" .HTMLBody = "<font size = 3>" & MessageText ' Set configuration. Dim iConfg As CDO.Configuration = New CDO.Configuration Dim oFields As ADODB.Fields oFields = iConfg.Fields Dim oField As ADODB.Field oField = oFields(cdoSendUsingMethod) oField.Value = 2 oField = oFields(cdoSMTPServer) oField.Value = "192.168.0.7" oField = oFields(cdoSMTPServerPort) oField.Value = 25 oField = oFields(cdoSMTPAuthenticate) oField.Value = 1 oField = oFields(cdoSMTPConnectionTimeout) oField.Value = 10 oFields.Update() .Configuration = iConfg .Send() cdomessage = Nothing iConfg = Nothing oFields = Nothing oField = Nothing End With cdomessage = Nothing Show quote "bnaveke" wrote: > How do you add categories to messages you create and send using CDO? Use Primary Interop Assemblies
Add reference Microsoft.Office.Interop.Outlook.dll to your Project Then Code: Dim OApp As New Microsoft.Office.Interop.Outlook.Application() Dim omail As Microsoft.Office.Interop.Outlook.MailItem OMail = OApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem) omail.To = "someper***@someserver.com" omail.Subject = "Test Cat" omail.Categories = "1. PURPOSE;1. IMPORTANT;7. Outside Engineering" omail.Body = "You should have 3 categories in your outgoing message!" omail.Send() Show quote "bnaveke" wrote: > Sorry, should have been more specific....CDO 1.21 > > I'm looking at outgoing message created from VB.Net. I'm creating a new > CDO.message in VB.net code and want to attach categories and then send it. In > the example below how would add categories to the CDO.message? > > for example > > Const cdoSendUsingMethod As Object = > "http://schemas.microsoft.com/cdo/configuration/sendusing" > Const cdoSendUsingPort As Object = 2 > Const cdoSMTPServer As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpserver" > Const cdoSMTPServerPort As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpserverport" > Const cdoSMTPConnectionTimeout As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" > Const cdoSMTPAuthenticate As Object = > "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" > Const cdoBasic As Integer = 1 > > Dim cdomessage As CDO.Message = New CDO.Message > > With cdomessage > .From = "Accounting-Time" > .To = "Per***@email.com" > .Subject = "Missing Time Sheets" > .HTMLBody = "<font size = 3>" & MessageText > > ' Set configuration. > Dim iConfg As CDO.Configuration = New CDO.Configuration > > Dim oFields As ADODB.Fields > oFields = iConfg.Fields > > Dim oField As ADODB.Field > oField = oFields(cdoSendUsingMethod) > oField.Value = 2 > oField = oFields(cdoSMTPServer) > oField.Value = "192.168.0.7" > oField = oFields(cdoSMTPServerPort) > oField.Value = 25 > oField = oFields(cdoSMTPAuthenticate) > oField.Value = 1 > oField = oFields(cdoSMTPConnectionTimeout) > oField.Value = 10 > > oFields.Update() > .Configuration = iConfg > > .Send() > > cdomessage = Nothing > iConfg = Nothing > oFields = Nothing > oField = Nothing > End With > > cdomessage = Nothing > > "bnaveke" wrote: > > > How do you add categories to messages you create and send using CDO? |
|||||||||||||||||||||||