Platform SDK: CDO 1.2.1

GetArticle Method (Session Object)

The GetArticle method returns a Message object corresponding to an article number.

Syntax

Set objMsg = objSession.GetArticle(ArticleID, FolderID [, StoreID] )

objMsg
On successful return, represents the Message object.
objSession
Required. The Session object.
ArticleID
Required. Long. Specifies the article number of the message to be retrieved.
FolderID
Required. String. Specifies the unique identifier of the folder from which to obtain the message.
StoreID
Optional. String. Specifies the unique identifier of the message store containing the folder that contains the message. StoreID defaults to the current session's default message store.

Remarks

The GetArticle method retrieves any Message object for which you can supply an article number. You do not have to know the message's ID property.

An article number is a long integer associated with an item in a message store. The store computes and sets the article number on each item as it is added to a folder. Every item in every folder is assigned an article number, regardless of its Type property, that is, its message class.

Not all message stores support article numbers. If you call GetArticle specifying a store that does not support them, CdoE_NOT_FOUND is returned.

The advantage of an article number is that it is only 32 bits long, as opposed to the item's unique identifier in its ID property, which is typically on the order of 70 bytes. If you are constructing a URL to reference the item, you can make the URL appreciably shorter by using the item's article number instead of its unique identifier.

Unlike a unique identifier, an article number is only unique within a single folder. Therefore, unlike the GetMessage method, GetArticle requires that you specify the folder with the FolderID parameter. The item to be retrieved must also be in the normal Messages collection of the folder. If you specify the article number of an item in the HiddenMessages collection, GetArticle returns CdoE_NOT_FOUND.

An article number should not be confused with the Index property available on members of several CDO collections. An article number is assigned once and changes only when the item is modified with the Update method, while the Index property on a member of a collection can change when other members are added or deleted, or when the collection is sorted.

The GetArticle method can be used to decode a URL that refers to a message by article number. Such a URL is typically of the form

http://server/virtroot/forms/openitem.asp?folder=<foldername>&art=<articlenum> 
 

The unique identifier of a Folder object can be obtained from its ID property. A message store's unique identifier is returned by the InfoStore object's ID property.

Performance is likely to be improved if you supply the StoreID parameter.

The article number of an item in a folder corresponds to the MAPI property PR_INTERNET_ARTICLE_NUMBER on that item. When you are constructing a URL, you can use the Message object's Fields property to obtain its article number:

   Dim article As Long ' article number of message 
   article = objMessage.Fields(CdoPR_INTERNET_ARTICLE_NUMBER) 
 

You can use this approach to see if the message store you are dealing with supports article numbers, because if it does, it assigns them to every item in every folder.