Partager via


Posting by Using Exchange

Topic Last Modified: 2006-06-11

When posting using Microsoft® Exchange Server 2007 , Collaboration Data Objects (CDO) uses either the Network News Transfer Protocol (NNTP) protocol or posts the message directly to a folder specified in the hardlinklist property.

A special set of configuration properties can be set when posting messages using Exchange. Each property in the following table is within the https://schemas.microsoft.com/cdo/configuration/ namespace unless denoted otherwise.

Property Name Description

https://schemas.microsoft.com/exchange/hardlinklist

An array of URLs that identify public folders in which to post the message. Currently, only one URL can be set in the array. If set, the Newsgroups property is ignored, and an OLE DB provider is used to post the message directly to the public folder. To avoid rebinding the object's data source, specify an open Connection object to use when posting in the activeconnection property.

activeconnection

An open Microsoft ActiveX® Data Objects (ADO) Connection object to the public store in which the folder specified in the hardlinklist property resided. If this property is set, the connection is used to post the message to the public folder. You set this property if you do not want a currently bound Message object to rebind to the folder when posting. Normally, when messages are posted using Exchange to the folders in the hardlinklist property, CDO binds to the folderx, and the current DataSource binding for the object is therefore changed.

postusername

The user's user principal name (UPN). For example, mailto:user1@domain.tld or user1@domain.tld. This username is used along with the password to post messages directly to folders on remote Exchange servers.

postpassword

The user's password.

The following examples demonstrate posting messages using Exchange directly to a particular folder.

Example

VBScript

Sub PostToFolderUsingExchange(strFolderURL, strMailboxURL, objConn, strFrom, strSubject, strText)

  ' Assume type information has been imported into the script host.
  ' e.g. <reference object="CDO.Message"/> in .wsf script file.
  Set objMsg = CreateObject("CDO.Message")

  objMsg.Configuration(cdoPostUsingMethod) = cdoPostUsingExchange
  objMsg.Configuration(cdoMailboxURL) = strMailboxURL
  objMsg.Configuration(cdoActiveConnection) = objConn
  objMsg.Configuration.Fields.Update

  objMsg.Fields.Item(cdoHardLinkList) = Array(strFolderURL)
  objMsg.Fields.Update

  With Msg
    .From     = strFrom
    .Subject  = strSubject
    .TextBody = strText
    .Post
  End With

End Sub