Open a _PostItem in custom form.

  • Thread starter Vladimir Chtchetkine
  • Start date
V

Vladimir Chtchetkine

This is a big one for me. I want an item (doesn't really matter, _Mail or
_Post but preferably _Post) to be opened (_Inspector'ed) in a specific form
(I have a form file that I want to use). But no matter what I do, item keeps
opening in a default Outlook form.

I have an ugly work around: on item open (ItemEvents:Open) I create a new
item (using _Application::CreateItemFromTemplate(), copy all the properties
from the original item to the created one, create and open a new _Inspector
for that "templated" item, and set Calncel param to ItemEvents::Open to
true, so original item wouldn't open. Then, when inspector with "templated"
item is closing I copy all the changes to the original item and delete
"templated" one.

Ugly, huh?

Is there more elegant solution? I mean can I (from inside an add-in) open an
existing Outlook item in an arbitrary form (well, form, that supports item's
type)?



TIA,



Vladimir
 
V

Vladimir Chtchetkine

Thank you!



I'm afraid that this is not enough. To some extent, this is similar to what
I already do (_Application.CreateItemFromTemplate). But what I need is to
change form in which an item gets open "on the fly". Not a new item created
with the form, but an existing item opened with the form and (possibly)
every time with the different one. Another desirable thing would be not
"publish" form but rather use a form (.oft) file (like
CreateItemFromTemplate uses). Am I asking for too much?



Regards,



Vladimir
 
K

Ken Slovak

In the case you want you have to set the item's MessageClass explicitly then
after you open it and you must be using a published form or you will create
one-offed items. CreateItemFromTemplate will have the disadvantage that
unless the form is published no code in it will run and you will be creating
one-offed items.

In addition, doing it that way will not help if your custom form has user
properties or fields added to it since those won't have any values that will
be preserved unless any and all possible fields you want are added to the
folder already then added to the items you open that way and then you add
user properties to those items. Pretty messy.
 
V

Vladimir Chtchetkine

I don't have any code in the form. I do have code in my code though :) And
what I do (since I control open anyways) I use _Inspector's interface to get
to the form then I go through the list of controls in that form filling them
in with whatever I'm pleased. Than, when item is saving I go "backwards",
collecting info entered into the form and saving it to the item.
Since we've touched that subject, somehow I can't get name of the property
to which a control in the form is bound. So, when designing a form I have to
go through the process of assigning a tag to each and every control and this
way providing my code with an idea of what particular property this control
represents. I don;t think that users would appreciate this "extra work". So,
is there any way I can know which UserProperty a control in the form is
bound to?
I don't worry much (yet) about exact match between set of a) item
properties, b) folder columns and c) bindings in form controls because all
three are under my control. Yeah, it's messy but... :)

Sorry for too many questions floating from one subject to another but I'm
pretty much new to Outlook business and there is just too much unknowns for
me.

Thanks for all your help,

Vladimir
 
K

Ken Slovak

Well, I'm sure the binding is stored somewhere in the form description but
it's most likely in some binary property that is completely undocumented.
 

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