none
distributing custom view of contact folder RRS feed

  • Question

  • I had setup a custom view for a customized contact folder that has a specific class and displays specific columns based on List view.  It seems the only way I can transfer this view to another user is by copying this template contact folder to a pst file then open pst file on other user and was wondering if there's a better and easier way to go about doing this as I suppose as an add-in or something?
    Friday, October 19, 2012 7:27 PM

Answers

  • To view the existing view XML, you can access it programmatically and (while your code is in the debugger) look at the value and copy it to the clipboard.

    You can also look at the XML value usng OutlookSpy - click Folder button, select CurrentView, expand the propety or click Browse, then select the XML property.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Tuesday, October 23, 2012 1:51 PM

All replies

  • Custom views are stored as hidden (associated) messages in a folder - you can see them in OutlookSpy if you click IMAPIFolder button, then go to the "Associated Contents" tab.

    While Outlook Object Model allows to access hidden message as StorageItem objects, it will not allow to save them as MSG files or import them back.

    You can save hidden mesages either using Extended MAPI (C++ or Delphi), or using Redemption: RDOFolder.HiddenItems collection, RDOMail.SaveAs(..., olMsg). Once you have an MSG file, you can import it back using RDOFolder.HiddenItems.Add (returns RDOMail object), then call RDOMail.Import(..., olMsg).


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Friday, October 19, 2012 11:19 PM
  • So if I understand correctly, in order to have custom views for desired contact folder, I would need to create specific hidden messages for that?  I just want to make my demanding network administrator's job easier as my guess is I would need to create yet another c# add-in to accomplish and satisfy this. 
    Monday, October 22, 2012 1:31 PM
  • That is correct.

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Monday, October 22, 2012 1:58 PM
  • You can get the current view XML for a folder (Folder.CurrentView.XML). That can be saved as text and then used to set the view of any folder desired using code. You do not need to explicitly create hidden messages.
     
    If you get a target folder and its Views collection you can use the Add() method to add the XML for the desired view. Once that is added to the Views collection and saved you can then set the folder's current view to the desired view by using the View.Reset() method, followed by the View.Apply() method

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "jfalberg" <=?utf-8?B?amZhbGJlcmc=?=> wrote in message news:ea900fe9-b61d-4f83-8130-f9dcc99b2e8c...
    So if I understand correctly, in order to have custom views for desired contact folder, I would need to create specific hidden messages for that?  I just want to make my demanding network administrator's job easier as my guess is I would need to create yet another c# add-in to accomplish and satisfy this. 

    Ken Slovak MVP - Outlook
    Monday, October 22, 2012 2:12 PM
    Moderator
  • Is there any examples available that would help me get started of how I can accomplish this?
    Monday, October 22, 2012 2:13 PM
  • I don't think all view settings will be in the XML...

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Monday, October 22, 2012 2:17 PM
  • Other than auto-format settings they pretty much are I think. I've used that method to publish views many times pretty successfully.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Dmitry Streblechenko _MVP_" <=?utf-8?B?RG1pdHJ5IFN0cmVibGVjaGVua28gX01WUF8=?=> wrote in message news:54087c30-6874-4590-8804-088f745afb72...
    I don't think all view settings will be in the XML...

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Ken Slovak MVP - Outlook
    Monday, October 22, 2012 2:28 PM
    Moderator
  • In getting back to this, so if I understand this correctly, I should be able to save my view to an xml file, then somehow programmatically open it in target folder.  Are there steps out there on how to do this properly?
    Monday, October 22, 2012 8:16 PM
  • There are examples using VBA in the object browser help in the Outlook VBA project. Just click F1 on something like Views.Add() or any other method/property/event you want to see.
     
    The XML is used as a string, so however you want to retrieve that information. It could be a file or a string resource or whatever. You set the View.XML property and reset the view, save the newly created view, then apply the new view.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "jfalberg" <=?utf-8?B?amZhbGJlcmc=?=> wrote in message news:94fe49c9-150f-45ed-b78a-9db8ee9050e0...
    In getting back to this, so if I understand this correctly, I should be able to save my view to an xml file, then somehow programmatically open it in target folder.  Are there steps out there on how to do this properly?

    Ken Slovak MVP - Outlook
    Monday, October 22, 2012 9:09 PM
    Moderator
  • I see there was a vba example in views.add.  I wonder if I could somehow embed it in my script editor for custom form or at least someplace where only the network administrator can get to it.  Essentially I would need to create the view or set the existing custom view accordingly.  Is there a way I can view the xml file for the existing view so I can have a master template to utilize?  I also wonder if I can also do an advanced search and implement a custom view as well this way too since that was a gripe I had concerning advanced search feature.
    Tuesday, October 23, 2012 1:42 PM
  • To view the existing view XML, you can access it programmatically and (while your code is in the debugger) look at the value and copy it to the clipboard.

    You can also look at the XML value usng OutlookSpy - click Folder button, select CurrentView, expand the propety or click Browse, then select the XML property.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!


    Tuesday, October 23, 2012 1:51 PM
  • Is there any field I should find it in? 

    I'm trying to search in where I have "Dim objViews As Outlook.Views" but I only see 4 items associated with it:

    item 1. Sent To
    item 2. Compact
    item 3. Single
    item 4. Preview

    My custom list view is named "Rolodex"

    edit:  turned out I was looking at "Set objViews = objName.GetDefaultFolder(olFolderInbox).Views"
    instead of "objName.GetDefaultFolder(olFolderContacts).Views"

    but still can't seem to locate "Rolodex"

    Now looking in watches on "objName.Folders(1).Folders("Rolodex")"



    • Edited by jfalberg Tuesday, October 23, 2012 2:45 PM update
    Tuesday, October 23, 2012 2:20 PM
  • As an update I got to where I can see the XML in my watch but it appears to be cut off when I copy and paste the watch. 

            : XML : "<?xml version="1.0"?>
    <view type="table">
     <viewname>Rolodex</viewname>
     <viewstyle>table-layout:fixed;width:100%;font-family:Segoe UI;font-style:normal;font-weight:normal;font-s"

    Edit: managed to write contents of XML to an external file, looks rather huge so far.
    now to figure how to use it.
    • Edited by jfalberg Tuesday, October 23, 2012 3:29 PM update
    Tuesday, October 23, 2012 2:54 PM
  • So I now have a text file of the XML and need to provide my network administrator with a way to get this view on multiple workstations.  Should I do this as yet another addin or maybe make a hidden button on my form so he can press it as it runs through the script editor if possible.
    Tuesday, October 23, 2012 4:09 PM