Tag Archives: View

Views not getting applied for the very first time


Recently i worked in a issue with a developer customer where they tried applying the Outlook views programmatically. They noticed that the Outlook views are not correctly set or applied – specifically, when you create the Outlook profile for the first time and run against it. It happens for the very first time, when you create a new mail and apply the views against the given Outlook profile and during investigation i found this is by design. Unfortunately there is no refresh available for views or apply to do the changes inside the method. As an alternate workaround, we found that by switching the folders, returning the same folder works and re-applying the views works.

Outlook Object Model: How to assign a Webpage to a specific Outlook folder programmatically?


In this post we will see how to assign a web page to a specific Outlook folder programmatically using C# and Outlook Object Model. For this I tried the following sample, which checks for a folder named “HtmlView” in Microsoft Office Outlook. If the folder does not exist, the code creates the folder and assigns a Web page to it. If the folder exists, the code displays the folder contents.

The following sample is written using C#.Net, Visual Studio 2010 and Outlook 2010 (Outlook Object Model API).

Code snippet:

   1: //Microsoft.Office.Interop.Outlook._Application

   2: // Create an Outlook application.

   3: Outlook._Application oApp = new Outlook.Application();

   4:  

   5: // Get the MAPI NameSpace and Logon values.

   6: Outlook._NameSpace oNS = (Outlook._NameSpace)oApp.GetNamespace("MAPI");

   7: oNS.Logon(Missing.Value, Missing.Value, true, true);

   8:  

   9: //Assign a Web page with a specific Outlook folder

  10: Outlook.MAPIFolder newView = null;

  11: string viewName = "HtmlView";

  12: Outlook.MAPIFolder inBox = (Outlook.MAPIFolder) oApp.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

  13: Outlook.Folders searchFolders = (Outlook.Folders)inBox.Folders;

  14: bool foundView = false;

  15:  

  16: foreach (Outlook.MAPIFolder searchFolder in searchFolders)

  17: {

  18:    if (searchFolder.Name == viewName)

  19:       {

  20:          newView = inBox.Folders[viewName];

  21:          foundView = true;

  22:       }

  23: }

  24:  

  25: if (!foundView)

  26: {

  27:      newView = (Outlook.MAPIFolder)inBox.Folders. Add("HtmlView", Outlook.OlDefaultFolders.olFolderInbox);

  28:      newView.WebViewURL = "http://www.microsoft.com";

  29:      newView.WebViewOn = true;

  30: }

  31:  

  32: oApp.ActiveExplorer().SelectFolder(newView);

  33: oApp.ActiveExplorer().CurrentFolder.Display();

Run the sample and you will see the following output in Outlook:

Outlook 2010 - Output

Happy programming!!

Download: Rollup 4 for Exchange Server 2010 Service Pack 1


Click here to download Rollup 4 for Exchange Server 2010 Service Pack 1. 

Some of the known issues were addressed @ Update Rollup 4 for Exchange Server 2010 SP1:

  • 2465292 "MAPI_E_FAILONEPROVIDER (0x8004011D)" error message when you access an Exchange Server 2010 mailbox by using a MAPI application

  • 2394554  An email message is not delivered if it contains unsupported encoded characters in the subject line in an Exchange Server 2010 environment

  • 2491951  You cannot install Exchange Server 2010 SP1 if the NetBIOS domain name of the domain controller contains an ampersand (&) character

  • 2500648 "There are no items to show in this view." error message when you try to view a folder in Outlook in an Exchange Server 2010 environment

  • 2533538 You cannot look up the free/busy information of a user who is located on an Exchange Server 2010 organization from another Exchange Server 2010 organization

  • 2506820 The free/busy information does not display of a user whose mailbox is located on an Exchange Server 2003 server

You can get the list of issues fixed in this Rollup available here.

MFC MAPI: How to view GAL entries


You can download the latest MFC MAPI utility to view GAL entries, which uses the Messaging API to provide access to MAPI stores through a graphical user interface.

Try the following steps:

1) Open MFC MAPI utility. Select Session menu and select “Logon and Display  Store table” ( I chosen for this session). It will ask you prompt the profile.

image

2) Select the profile. Once you select it, it will open the stores associated with it.

image

3) Select Address Book Menu and select "Open Default Directory” option

image

4) It will list out the GAL entries

image

5) If you select a GAL entry in the top pane, it will display its associated properties, tag, type, value etc in its below pane.

image

My View : Office 2010, what’s up, buddy?


Whenever our discussion turns towards Office 2010, most of my customers ask, “What’s up with Office 2010? Any new features? Some thing new for end users? What’s up buddy?”

There are many new features, user experiences available with each application/product of Office 2010 suite, which i reported couple of them earlier. Additionally I want to share couple of my experiences, that i personally tried.  

Regarding Office 2010, you can see new features, mobility, productivity and provide new dimensional user experiences:



  • Outlook Conversation view: I like this feature a lot, which helps me to keep track of conversation regarding a topic – whole thread for my view.


  • Use anywhere: Expect the best productivity experience across PCs, Phones and browsers.


  • Office anywhere: Find a new hands-on experience with Office Web Apps – people will be able to view, access, share and work with their Office documents from virtually anywhere.


  • Better Social Connectivity: It’s a social networking age, so our applications do. You can manage the professional, personal and social networks together with Outlook using Outlook Social Connector (OSC).


  • Mobile Office: You can have your whole office related work using Windows Mobile Office.


  • SharePoint Mobility: It’s just not Office, you can use SharePoint Mobility to access documents, lists, calendars on SharePoint 2010, performing people and document searches and receiving SMS alerts on SharePoint content.


  • x64 bit Office: As 64-bit processors and operating systems are becoming the standard for systems ranging from servers to desktop computers, 64-bit Office will be able to take advantage of everything that 64-bit systems have to offer. Microsoft Office 2010 marks the first time Office will be shipping in both 32-bit and 64-bit versions.


  • Virtualization & Office: Per Takeshi Numoto, CVP in Office, “App-V 4.6 provides Office customers with a robust set of features to tackle core challenges including application upgrade, application coexistence, and user readiness. It’s an exciting, powerful new way for IT to deliver Office 2010 quickly without impacting user productivity”


  • Office Graphics: With Office 2010, i do see lot of improvements for using Pictures – cropping pictures, background removal in Office 2010 (Word, PowerPoint, Excel and Outlook).


  • My custom ribbon: I can create, customize and personalize my own Ribbon that suits my Office 2010 client applications.


  • Click-to-Run: This new software delivery mechanism introduced with Office 2010. It based on MS App-V (again, virtualization and streaming technologies). Already i discussed regarding this.


  • UI Extensibility: With new Backstage View, you can provide support for customization and extend the UI per your custom requirement.


  • Product Key-card: Using this single license card (with no DVD media), we can access and experience Office 2010 on new PC’s pre-loaded with Office 2010.

I know the list above is few, but i like them more, as they help me to improve the productivity.


Hope this helps. I wish you to try new Office 2010 suite and have a wonderful user experience with Office 2010!!

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";
 
MAPIFolder _pstFolder;
//Add the PST
this.Application.Session.AddStoreEx(pstPath, OlStoreType.olStoreDefault);
_pstFolder = this.Application.Session.Folders[2];
 
//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;
...

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

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.

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mapifolder.webviewurl.aspx

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.