MS Office Forum / Outlook / Programming VBA / May 2008
Customize Task view on to-do bar programatically
|
|
Thread rating:  |
Ryan Taylor - 01 May 2008 14:29 GMT Hello,
I am in the process of creating new Views in Outlook 2007 (C#, VSTO 2008) and one criteria is to display the Icon property for tasks in both to the Task Pane, and the To-do Bar.
I am able to programatically create new Views that work perfectly in the Task Pane, however, I have been unable to figure out how to programmatically modify the view used in the to-do bar. If any one can point me in the right direction, I would greatly appreciate it as all I would like to do is add the Icon property.
Thanks, Ryan Taylor
Ken Slovak - [MVP - Outlook] - 01 May 2008 14:57 GMT The To-Do Bar is actually a view of a search folder. The search folder, To-Do Search, is stored under the Store.RootFolder. You can access it using this code (assuming you want to get at the To-Do Search folder in the default Store and "ns" is a NameSpace object:
Outlook.Store defaultStore = ns.GetDefaultFolder(Outlook.OlDefaultFolder.olFolderInbox).Store;
Outlook.Folder toDo = defaultStore.GetSpecialFolder(Outlook.OlSpecialFolders.olSpecialFolderAllTasks);
From there you can access the Views collection of the folder and proceed normally.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hello, > [quoted text clipped - 13 lines] > Thanks, > Ryan Taylor Ryan Taylor - 01 May 2008 16:57 GMT Hi Ken,
Thank you for your quick reply. I tried what you suggested however it didn't seem to work. I have included the relevant portion of code below, if you could take a look at it and what I might have missed from your sample, I would greatly appreciate it.
I am basically just analyzing the current view of the to-do bar and if it doesn't have the Icon property, trying to add it. I noticed that it WILL add the icon to the to-list view that you can choose from the task pane, however it does not seem to add it to the view showing on the to-do bar.
Code ============= public void somemethod() { Folder inboxFolder = _app.Session.GetDefaultFolder(OlDefaultFolders.olFolderInbox) as Folder; Folder todoBarFolder = inboxFolder.Store.GetSpecialFolder(OlSpecialFolders.olSpecialFolderAllTasks) as Folder; EnsureIcon(todoBarFolder); }
private void EnsureIcon(Folder todoBarFolder) { TableView view = todoBarFolder.CurrentView as TableView; bool containsIcon = false; foreach (object o in view.ViewFields) { ViewField field = o as ViewField; if (field == null) continue; if (field.ViewXMLSchemaName.Equals(ICON_NAME, StringComparison.InvariantCultureIgnoreCase)) { containsIcon = true; break; } } if (!containsIcon) { view.ViewFields.Insert(ICON_NAME, 1); view.Save(); } } =============
The biggest difference that I see from your code and mine is that I am using _app.Session, instead of going through the namespace, but I tried both and it didn't seem to make a difference.
Thanks, Ryan
> The To-Do Bar is actually a view of a search folder. The search folder, > To-Do Search, is stored under the Store.RootFolder. You can access it using [quoted text clipped - 26 lines] > > Thanks, > > Ryan Taylor Ken Slovak - [MVP - Outlook] - 01 May 2008 19:20 GMT I guess it all depends on the view itself. I was able to use similar code to add ReminderTime to the ToDo Bar view, but even though the field is now there in the view XML and ViewProperties collection it doesn't show up in the view itself in the UI. The ToDo Bar has some formatting that's on it that's very hard to change. It has that Arrange By and other things that prevent some data from showing up.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hi Ken, > [quoted text clipped - 56 lines] > Thanks, > Ryan Ryan Taylor - 01 May 2008 19:41 GMT Hi Ken,
It sounds like your results were similar to mine. It seems like we just aren't getting the correct view, it seems like the view the To-do bar is using ia view from somewhere else even though it has the same name as the other view. We are able to manually add the icon property by right clicking on the header (for example: right click on the Arrange by column) and choosing "Custom...". However, a major peice of this project is showing the icons for the task, specifically in the to-do bar, so I need to be able to make sure I can show them without depending on the user to manually go through the process. Can you think of anything else that we can try?
Thanks again for your help, it is greatly appreciated.
Best Regards, Ryan Taylor
> I guess it all depends on the view itself. I was able to use similar code to > add ReminderTime to the ToDo Bar view, but even though the field is now [quoted text clipped - 63 lines] > > Thanks, > > Ryan Ken Slovak - [MVP - Outlook] - 01 May 2008 23:48 GMT Well, I've had limited success in customizing views of almost any type of search folder in the past, and the To-Do Bar is just a view into a search folder. I haven't spent a lot of time on it though, if I have any time tomorrow I'll play around with it for a while.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hi Ken, > [quoted text clipped - 14 lines] > Best Regards, > Ryan Taylor Ryan Taylor - 03 May 2008 03:02 GMT Thanks Ken, it would be really great if you are able to find something.
Thanks, Ryan
> Well, I've had limited success in customizing views of almost any type of > search folder in the past, and the To-Do Bar is just a view into a search [quoted text clipped - 19 lines] > > Best Regards, > > Ryan Taylor Ryan Taylor - 05 May 2008 14:28 GMT Hi Ken,
I was wondering if you had any luck with getting other fields (namely the icon) to show up on the to-do bar programmatically?
Thanks, Ryan
> Thanks Ken, it would be really great if you are able to find something. > [quoted text clipped - 24 lines] > > > Best Regards, > > > Ryan Taylor Ken Slovak - [MVP - Outlook] - 05 May 2008 14:53 GMT No luck at all.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Hi Ken, > [quoted text clipped - 3 lines] > Thanks, > Ryan Ryan Taylor - 05 May 2008 15:04 GMT Fair enough, thanks for all of the time you spent looking. I wasn't able to find anything either. Do you know what other otions I have in terms of finding a solution to this problem?
Thanks, Ryan
> No luck at all. > [quoted text clipped - 5 lines] > > Thanks, > > Ryan Ken Slovak - [MVP - Outlook] - 05 May 2008 15:19 GMT None that I know of that will help. Filing a bug with MS or opening a case with support would likely lead to them telling you it can't be done and may not be fixed in Outlook 2007 at all.
I'll see if any of my friends have any other ideas.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> Fair enough, thanks for all of the time you spent looking. I wasn't able > to [quoted text clipped - 3 lines] > Thanks, > Ryan Ken Slovak - [MVP - Outlook] - 05 May 2008 20:22 GMT We discussed this privately and I think the reason it's not working is that the To-Do Bar allows a standard view only and the customization is making Outlook create a new view behind the scenes. To quote Sue Mosher:
"Outlook does not allow you to programmatically modify a standard view -- another pain point. If you try to modify an existing standard view, Outlook clones the settings and creates a copy that is a user-specific view. My hunch is that the to-do bar can use only the master view, not the user-specific copy."
Thanks Sue and Diane Poremsky for your help in the discussions.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm
> None that I know of that will help. Filing a bug with MS or opening a case > with support would likely lead to them telling you it can't be done and [quoted text clipped - 9 lines] >> Thanks, >> Ryan Ryan Taylor - 13 May 2008 22:10 GMT Hi Ken,
Thank you for researching this further. I apologize for not responding sooner, I apparently didn't receive the "new post notification" from the forum.
It is interesting, through the UI, I can modify that standard view and add the Icon field to it and it will show up. I do understand what you are saying, that when making these modifications programmatically, Outlook may create a copy and actually use the copy, instead of the modified view.
Since I am able to set this manually, is there some macro or something similar that I can create that will go and physically use the mouse to select this Icon field?
I know it seems like a small thing, but we customize the icons to indicate various states so it is really important that the users be able to see it. Unforunately, I cannot rely on them going and manually adding this field.
Thanks again for all of your help, both you and Sue and Diane, Ryan
> We discussed this privately and I think the reason it's not working is that > the To-Do Bar allows a standard view only and the customization is making [quoted text clipped - 21 lines] > >> Thanks, > >> Ryan Ken Slovak - [MVP - Outlook] - 14 May 2008 14:19 GMT No, there's nothing you can do in code. I had also verified this with the PM who owns the Outlook object model on the Outlook team.
 Signature Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm
> Hi Ken, > [quoted text clipped - 18 lines] > Thanks again for all of your help, both you and Sue and Diane, > Ryan
|
|
|