Wählen Sie das Produkt, für das Sie Hilfe benötigen:
- Internet Explorer
- Media Player
- Windows Phone
- Weitere Produkte
OL2000: Cannot Programmatically Create or Modify Views
Article ID: 262294 - View products that this article applies to.
This article was previously published under Q262294
The Microsoft Outlook object model does not provide support for creating or modifying views. This article summarizes possible approaches that you can take to work around this limitation.
You may be able to use the following options to meet the needs of your solution.
Use Pre-Defined ViewsThe Outlook object model does allow you to change views by using the CurrentView method. Therefore, depending on how your solution is designed, you may be able to create pre-defined views in the folder and then programmatically switch views based on some criteria.
Deploy an Entire FolderFor folder-based solutions, instead of trying to dynamically create views, you should consider deploying an entire folder instead. This deploys all the views that are contained in the folder. To do this:
Use the CDO Object Model to Move ViewsThe Collaborative Data Objects (CDO) 1.21 object model is based on the Messaging Application Programming Interface (MAPI) and generally provides lower-level access to Outlook data. CDO does not provide direct support for views, but because views are hidden messages in a folder, you can use CDO to move the messages. However, while Microsoft Product Support Services (PSS) can support moving hidden messages, PSS does not support the end result of moving views. There is no documentation about other properties or settings that you may need to change to get views that you deploy to fully function.
The following Outlook Visual Basic for Applications code illustrates how you can use CDO to access the views in your Inbox. It displays a list of the views in the Immediate window of the Visual Basic Editor. Make sure that you reference the Microsoft CDO 1.21 Library object library.
NOTE: This example only returns those views that are stored directly in your Inbox. When a view is created, you can choose to make the view available to all folders so that the view is not stored in your Inbox.
For additional information about how to move messages using the CDO object model, view the following CDO documentation on MSDN Web site:
Create Exchange ViewsAs a last resort, if you must dynamically create or modify views, you must use the Exchange SDK documentation to create the older Exchange views. Outlook currently supports this older view architecture for backwards compatibility but may not support this architecture in the future. Therefore, Microsoft does not recommend that you take this approach when you design a solution for Outlook. You must be familiar with the C/C++ programming language to implement this type of solution.
For additional information about how to work with Exchange views, please view the following MSDN Web site:
For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/146636/EN-US/ )OL2000: Questions About Custom Forms and Outlook Solutions