Customize Outlook current view with code(vba)

G

Guest

I created an add-in, and I want to add a custom field in the Inbox Explorer
through the code, and show in the current view. I want to do this through
the code, so when user open Outlook for the first time, if this field is not
in the view it should add the field. I want to distribute this add in to
hundred users, and I am looking for better way to customize view other then
me going to all of them and doing it manually. Any ideas?

Thanks,

Goran
 
K

Ken Slovak - [MVP - Outlook]

Customize the view you want to use manually and copy the view XML and use
that to apply a custom view in your addin code. I usually use the
BeforeFolderSwitch event handler to decide what kind of folder is being
switched to and whether or not to apply the custom view.

You can't add new folder fields, you can add a user property to every item
in a folder and set the property to be a folder fields property, which makes
it available for use in a view. Again, your addin code can add the property
when the addin runs.
 
G

Guest

Thanks Ken

Each user will have its own view and it could be different, so I can't copy
the same view xml for everyone. I would have to dynamically get the view xml
in BeforeFolderSwitch event. Check if the field is already there and if not
edit/update the xml to add the field, save and apply. Right? If yes, what
would be the easiest way to edit/update ActiveExplorer.CurrentView.XML in the
code to add new field?

Thanks again for your help,

Goran
 
K

Ken Slovak - [MVP - Outlook]

I use an XML processor when I have to do that, usually just from MSXML. I
usually use a reference to version 2 since it's on all modern systems, later
versions may not be unless I deploy it with my code, depending on updates
and OS version.
 
G

Guest

I will try. Thanks Ken.

Ken Slovak - said:
I use an XML processor when I have to do that, usually just from MSXML. I
usually use a reference to version 2 since it's on all modern systems, later
versions may not be unless I deploy it with my code, depending on updates
and OS version.
 
G

Guest

Sorry to bother you again Ken, but I finish customizing the view and
everything is fine now. How can I programmatically load the addin so when
user starts the outlook it loads it automatically, rather then me going to
add-in manager and finding the dll file and adding it manually.

Thanks again for your help
 
K

Ken Slovak - [MVP - Outlook]

If it's already listed in the COM Add-Ins dialog then you have it registered
and have LoadBehavior set to 2. For an addin to load then the host
application starts up LoadBehavior needs to be set to 3.
 
G

Guest

Thanks once again Ken.
I set the load behaviour to "Startup" in my addin, the host application is
Outlook 2003. Where do I set Load behaviour in Outlook?

Thanks
 
K

Ken Slovak - [MVP - Outlook]

Setting load behavior to startup should do the trick. If you are using an
addin designer that will register the addin to use LoadBehavior = 3.

Addins are registered in either HKCU or HKLM (the registry) at
\Software\Microsoft\Office\Outlook\Addins. Under that key is something like
MyAddin.Connect for your addin and LoadBehavior is one of the values
required (others are CommandLineSafe, Description and FriendlyName).
 
G

Guest

Thank you very much.

Ken Slovak - said:
Setting load behavior to startup should do the trick. If you are using an
addin designer that will register the addin to use LoadBehavior = 3.

Addins are registered in either HKCU or HKLM (the registry) at
\Software\Microsoft\Office\Outlook\Addins. Under that key is something like
MyAddin.Connect for your addin and LoadBehavior is one of the values
required (others are CommandLineSafe, Description and FriendlyName).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top