publish a new form automatically from an add-in

A

Acaccia

Ok now it works fine, the error was on folder name where I tried to
publicize my form:

CComVariant varContacts (oContacts);
CustomFormDescription->PublishForm(ofr,varContacts);
where

CComQIPtr <Outlook::MAPIFolder> oContacts;
Outlook::OlDefaultFolders enumODF = olFolderContacts;
olNs->GetDefaultFolder(enumODF,&oContacts);

Now... I have the contact list updated to new formby my add-in, but the work
is not still perfect...

1) updates of forms occurs only when I restart outlook application (the
add-in converts suddenly all MessageClass fields, but their look appears
like IPM.Contact nor like IPM.Contact.MyForm).

2) in contact list the add-in add always a new empty contact (via
CreateItemFromTemplate method)

How can I avoid this behavior?

Thank's in advance, Andrea

P.S. special thanks to Sue! :eek:)
 
S

Sue Mosher [MVP-Outlook]

1) Maybe you used the wrong form name to update the MessageClass property.
It must match the published form's class.

2) Why are you using CreateItemFromTemplate when you have a published form?
 
A

Acaccia

Sue Mosher said:
1) Maybe you used the wrong form name to update the MessageClass property.
It must match the published form's class.

I'm using right form name, because when I restart outlook all contacts has
the new form look (MessageClass="IPM.Contact.MyForm")

I publish the form by this code:

bstrName_T =_T("MyForm.oft"); //MyForm.oft is the file that will be
distributed
bstrName = bstrName_T.copy();
hr = m_spApp->CreateItemFromTemplate(bstrName,myFolder,(IDispatch**)
&CustomContactItem);

//if I don't use CreateItemFromTemplate() how can I obtain
CustomFormDescription? Where can I find new form model?

CustomContactItem->get_FormDescription(&CustomFormDescription);

bstrName_T = _T("MyForm");
bstrName = bstrName_T.copy();
CustomFormDescription->put_Name(bstrName);
Outlook::OlFormRegistry ofr = olFolderRegistry;

CComVariant varContacts (oContacts);

CustomFormDescription->PublishForm(ofr,varContacts);
Outlook::OlInspectorClose oic = olSave;
CustomContactItem->Close(oic);

2) Why are you using CreateItemFromTemplate when you have a published
form?

I want distribute my new form by an oft file... there are other ways to
automatically publicize my forms without oft files?

Andrea
 
S

Sue Mosher [MVP-Outlook]

Perhaps I'm misunderstanding the problem then. Please restate the issue.
Your latest message did not include enough information.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Acaccia said:
"Sue Mosher [MVP-Outlook]" <[email protected]> ha scritto nel
messaggio
1) Maybe you used the wrong form name to update the MessageClass
property.
It must match the published form's class.

I'm using right form name, because when I restart outlook all contacts has
the new form look (MessageClass="IPM.Contact.MyForm")

I publish the form by this code:

bstrName_T =_T("MyForm.oft"); //MyForm.oft is the file that will be
distributed
bstrName = bstrName_T.copy();
hr = m_spApp->CreateItemFromTemplate(bstrName,myFolder,(IDispatch**)
&CustomContactItem);

//if I don't use CreateItemFromTemplate() how can I obtain
CustomFormDescription? Where can I find new form model?

CustomContactItem->get_FormDescription(&CustomFormDescription);

bstrName_T = _T("MyForm");
bstrName = bstrName_T.copy();
CustomFormDescription->put_Name(bstrName);
Outlook::OlFormRegistry ofr = olFolderRegistry;

CComVariant varContacts (oContacts);

CustomFormDescription->PublishForm(ofr,varContacts);
Outlook::OlInspectorClose oic = olSave;
CustomContactItem->Close(oic);

2) Why are you using CreateItemFromTemplate when you have a published
form?

I want distribute my new form by an oft file... there are other ways to
automatically publicize my forms without oft files?

Andrea
 
A

Acaccia

Issue 1) is now solved:

Outlook::OlInspectorClose oic = olSave;
CustomContactItem->Close(oic);

become

Outlook::OlInspectorClose oic = olDiscard;
CustomContactItem->Close(oic);

Andrea
 
A

Acaccia

Sue Mosher said:
Perhaps I'm misunderstanding the problem then. Please restate the issue.
Your latest message did not include enough information.

Well... I'm developing a C++ add-in that must to load a customized contact
form when outlook start.
Now, this add-in will be distriubute to people that automatically (when
outlook starts), has forms changed.
The project consists of a COM C++ add-in that publish an oft file that
include the new form look.
The issue is that when outlook start, even though MessageClass of forms
change to IPM.Contact.MyForm,
visual changes appear only when I restart outlook again.

Bye, Andrea
 
S

Sue Mosher [MVP-Outlook]

What visual changes are you expecting to see? To what forms library are you
publishing? What version of Outlook?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Acaccia said:
"Sue Mosher [MVP-Outlook]" <[email protected]> ha scritto nel
messaggio
Perhaps I'm misunderstanding the problem then. Please restate the issue.
Your latest message did not include enough information.

Well... I'm developing a C++ add-in that must to load a customized contact
form when outlook start.
Now, this add-in will be distriubute to people that automatically (when
outlook starts), has forms changed.
The project consists of a COM C++ add-in that publish an oft file that
include the new form look.
The issue is that when outlook start, even though MessageClass of forms
change to IPM.Contact.MyForm,
visual changes appear only when I restart outlook again.

Bye, Andrea
 
S

Sue Mosher [MVP-Outlook]

You still don't seem to understand that you need to quote enough of the
previous message(s) to tell the full story in your current post. Every time
I try to get enough information to respond, you don't quote the earlier
exchange, so we have to start over at the beginning. I am getting somewhat
weary of this.

If my memory serves me correctly, though, you're not seeing items open in
the custom form. Do these items have their MessageClass property set to the
form's class? Occasionally I've seen that a new form won't load into the
local cache and overwrite an earlier version until the user creates a new
item with that form. Perhaps you could try creating a new item
programmatically (MAPIFolder.Items.Add -- the form class is the argument)
and then display and immediately close it.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Acaccia said:
"Sue Mosher [MVP-Outlook]" <[email protected]> ha scritto nel
messaggio
What visual changes are you expecting to see?

I have added a new custom tab (whit various text fields) in contact form
item
To what forms library are you
publishing?

I've published in Outlook's _Contacts folder (Folder libraries)

What version of Outlook?
2003

Bye!
Andrea
 

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