Outlook Object Model : Why i can’t able to assign value for MAPIFolder.WebViewURL ?
One of my customer had created an Outlook Add-in using VSTO & Outlook Object Model (OOM). As per the business logic, he need to implement the WebViewURL in it. The MAPIFolder.WebViewURL works fine and take’s us to set value to it most of the times, but it doesn’t function as expected in some time; the strange thing is it’s not throwing any error or exception when we execute the code.
//[Code Snippet : C# , VSTO, Outlook Object Model (OOM)]
//Provide the non-default store path
String pstPath = @"providelocalpath like c:\personals.pst";
//Add the PST
_pstFolder = this.Application.Session.Folders;
//Provide PSTFolder Name
_pstFolder.Name = "SampleFolder";
//Set the values
MAPIFolder mf = _pstFolder.Folders.Add("MyHtmlView", Type.Missing);
//Assign value for MAPIFolder.WebViewURL
mf.WebViewURL = "http://www.microsoft.com";
mf.WebViewOn = true;
MAPIFolder.WebViewURL Property (Microsoft.Office.Interop.Outlook) Returns or sets a String (string in C#) indicating the URL of the Web page that is assigned to a folder. Read/write.
When we start troubleshooting the case, we found that the issue happens for the non-default stores.
During research we found couple of community blog post references, Randy & Ryan’s MS Press book that with respect to Microsoft Office Outlook 2007, the home page setting is disabled for non-default stores. Non-default stores can include Personal Folders files (.pst) or the Microsoft Windows SharePoint Services folders. These folders are also stored in a .pst file. To see the home page setting for a non-default store, right-click the store in the Navigation Pane, click Properties, and then click the Home Page tab.
By default, you cannot type or paste a URL in the Address box. This issue occurs because, by default, home pages are disabled for non-default stores. To overcome this issue, we don’t have any programmatic resolution; but we can implement the resolution by refer the following support KB.