Microsoft Knowledge Base Email Alertz

(322893) - Describes how to enable message journaling for an Exchange Server mailbox store by using the CDOEXM IMailboxStoreDB interface. You must perform this operation on a computer that is running Exchange.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 322893 - Last Review: October 25, 2007 - Revision: 3.3

How to enable message journaling for an Exchange Server mailbox store by using Visual C++ 6.0

This article was previously published under Q322893

INTRODUCTION

This article describes how to enable message journaling on a Microsoft Exchange Server mailbox store by using the IMailboxStoreDB interface in Collaboration Data Objects for Exchange Management (CDOEXM).

When a mailbox store is enabled for journaling, the msExchMessageJournalRecipient attribute is set to the distinguished name of the user account object where you want to archive the messages for this store.

MORE INFORMATION

The following C++ sample demonstrates how to enable message journaling on a mailbox store:
  1. Start Microsoft Visual C++ 6.0.
  2. On the File menu, click New.
  3. Click Win32 Console Application, type Q322893 in the Project name box, and then click OK.
  4. Click A simple application, and then click OK.
  5. Replace all the code in the Q322893.cpp file with the following code:
    #import "c:\Program Files\Common Files\Microsoft Shared\CDO\cdoex.dll" no_namespace raw_interfaces_only rename("Folder","EXFolder") 
    #import "c:\Program Files\Exchsrvr\BIN\cdoexm.dll" no_namespace raw_interfaces_only
    #import "c:\Program Files\Common Files\System\ado\msado15.dll" no_namespace raw_interfaces_only  rename("EOF","adoEOF")
    
    int main(void)
    {
    	::CoInitialize(NULL); 
    {
    	IMailboxStoreDBPtr pMailboxStoreDB(__uuidof(MailboxStoreDB));
    	IDataSource2* pDataSource2 = NULL;
    	Fields* pFields = NULL;
    
    	HRESULT hr = pMailboxStoreDB->get_DataSource(&pDataSource2);
    	if (SUCCEEDED(hr))
    	{
    		//TODO Change this to reflect your environment
    		hr = pDataSource2->Open(
    			L"LDAP://MyServer.Mydomain.com/CN=2nd Mailbox Store,CN=First Storage Group,CN=InformationStore,CN=MyServer,CN=Servers,CN=SITE1,CN=Administrative Groups,CN=MyOrganization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=MyDomain,DC=com",
    			NULL, 
    			adModeReadWrite, 
    			adFailIfNotExists,
    			adOpenSource, 
    			L"",
    			L""); 
    		if (SUCCEEDED(hr))
    		{
    			//pVarFields = pMailboxStoreDB->GetFields();
    			hr = pMailboxStoreDB->get_Fields(&pFields);
    
    
    			if (pFields)
    			{
    				//Append property
    				_bstr_t _bstrName("msExchMessageJournalRecipient");
    				
    				//TODO Change this to reflect your environment
    				_variant_t vFieldValue("CN=MyUser,CN=Users,DC=MyDomain,DC=com"); 
    
    				//Append only if the field is empty
    				hr = pFields->Append(
    					_bstrName, 
    					adBSTR, 
    					_bstrName.length(),
    					adFldUpdatable, 
    					vFieldValue);
    
    				if (SUCCEEDED(hr))
    				{
    					//Update cache and directory
    					hr = pFields->Update();
    					hr = pDataSource2->Save();
    				} 
    				pFields->Release();
    			}
    		} 
    		pDataSource2->Release();
    		pDataSource2 = NULL;
    	} 
    }
    	::CoUninitialize();
    	return 0;
    }
    
  6. Search for TODO in the code, and then modify the code for your environment.
  7. Build and run the program.

REFERENCES

For more information about how to use the Exchange System Manager to enable journaling, click the following article number to view the article in the Microsoft Knowledge Base:
261173  (http://kbalertz.com/Feedback.aspx?kbNumber=261173/ ) How to enable message journaling in Exchange 2000
For additional information about message journaling, see the Exchange System Manager Help file.

For additional information about CDOEXM, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn2.microsoft.com/en-us/library/ms876280.aspx (http://msdn2.microsoft.com/en-us/library/ms876280.aspx)

APPLIES TO
  • Microsoft Collaboration Data Objects for Exchange Management 1.1
  • Microsoft Exchange 2000 Server Standard Edition
  • Microsoft Exchange Server 2003 Enterprise Edition
  • Microsoft Exchange Server 2003 Standard Edition
  • Microsoft Visual C++ 6.0 Standard Edition
  • Microsoft Visual C++ 6.0 Enterprise Edition
  • Microsoft Visual C++ 6.0 Professional Edition
Keywords: 
kbprogramming kbhowtomaster kbhowto KB322893
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate