Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Publish form Issues

Geek News

Publish form Issues
"spareway" <spareway[ at ]gmail.com> 1/15/2007 4:18:54 PM
Hi,

I am trying to publish a form via an outlook addin. When I call
Publish Form, I get an exception that says: one or more paramters are
incorrect.

any ideas?

thanks,

craig


Outlook.MailItem theItem;
Outlook.FormDescription theDesc;

//Environment.GetFolderPath(Environment.SpecialFolder.Personal)
Ol.MAPIFolder draftFolder =
OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderDrafts);
theItem = (Outlook.MailItem)
this.OutlookApp.CreateItemFromTemplate(formPath, draftFolder);
theDesc = theItem.FormDescription;
theDesc.DisplayName = formName;

Ol.MAPIFolder inboxFolder =
OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderInbox);
theDesc.PublishForm(Outlook.OlFormRegistry.olPersonalRegistry,inboxFolder
);
theItem.Close(Outlook.OlInspectorClose.olDiscard);

Re: Publish form Issues
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 1/15/2007 4:30:43 PM
It looks more or less OK to me.

Does it help any if you cast everything as you retrieve it? Are all your
objects OK if you step the code in the debugger?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"spareway" <spareway[ at ]gmail.com> wrote in message
news:1168877934.312069.315800[ at ]11g2000cwr.googlegroups.com...
[Quoted Text]
> Hi,
>
> I am trying to publish a form via an outlook addin. When I call
> Publish Form, I get an exception that says: one or more paramters are
> incorrect.
>
> any ideas?
>
> thanks,
>
> craig
>
>
> Outlook.MailItem theItem;
> Outlook.FormDescription theDesc;
>
> //Environment.GetFolderPath(Environment.SpecialFolder.Personal)
> Ol.MAPIFolder draftFolder =
> OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderDrafts);
> theItem = (Outlook.MailItem)
> this.OutlookApp.CreateItemFromTemplate(formPath, draftFolder);
> theDesc = theItem.FormDescription;
> theDesc.DisplayName = formName;
>
> Ol.MAPIFolder inboxFolder =
> OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderInbox);
> theDesc.PublishForm(Outlook.OlFormRegistry.olPersonalRegistry,inboxFolder
> );
> theItem.Close(Outlook.OlInspectorClose.olDiscard);
>

Re: Publish form Issues
"spareway" <spareway[ at ]gmail.com> 1/15/2007 5:42:26 PM
Hi Ken,

All my objects look ok, except for the inBoxFolder. I am not sure if
this is an issue but when i look at the UserPermissions property of the
inBoxFolder object it says:

<error: an exception of type:
{System.Runtime.InteropServices.COMException} occurred>.

could this be the problem?

Also the DisplayName is set to IPM.Note.XXX. Is this ok? What is
display name used for anyway?

thanks,

craig

Ken Slovak - [MVP - Outlook] wrote:
[Quoted Text]
> It looks more or less OK to me.
>
> Does it help any if you cast everything as you retrieve it? Are all your
> objects OK if you step the code in the debugger?
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Options
> http://www.slovaktech.com/products.htm
>
>
> "spareway" <spareway[ at ]gmail.com> wrote in message
> news:1168877934.312069.315800[ at ]11g2000cwr.googlegroups.com...
> > Hi,
> >
> > I am trying to publish a form via an outlook addin. When I call
> > Publish Form, I get an exception that says: one or more paramters are
> > incorrect.
> >
> > any ideas?
> >
> > thanks,
> >
> > craig
> >
> >
> > Outlook.MailItem theItem;
> > Outlook.FormDescription theDesc;
> >
> > //Environment.GetFolderPath(Environment.SpecialFolder.Personal)
> > Ol.MAPIFolder draftFolder =
> > OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderDrafts);
> > theItem = (Outlook.MailItem)
> > this.OutlookApp.CreateItemFromTemplate(formPath, draftFolder);
> > theDesc = theItem.FormDescription;
> > theDesc.DisplayName = formName;
> >
> > Ol.MAPIFolder inboxFolder =
> > OutlookApp.Session.GetDefaultFolder(Ol.OlDefaultFolders.olFolderInbox);
> > theDesc.PublishForm(Outlook.OlFormRegistry.olPersonalRegistry,inboxFolder
> > );
> > theItem.Close(Outlook.OlInspectorClose.olDiscard);
> >

Re: Publish form Issues
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 1/15/2007 6:24:23 PM
A problem with the Inbox would definitely be a problem with your code.
However, I don't know what the UserPermissions property is in the Inbox
folder, it's not an exposed property in the Outlook object model.

DisplayName defaults to the custom MessageClass unless you enter a different
string for that property when the custom form is published. It's not an
important property for anything other than what shows up in the custom forms
manager.



--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"spareway" <spareway[ at ]gmail.com> wrote in message
news:1168882946.044337.200400[ at ]v45g2000cwv.googlegroups.com...
[Quoted Text]
> Hi Ken,
>
> All my objects look ok, except for the inBoxFolder. I am not sure if
> this is an issue but when i look at the UserPermissions property of the
> inBoxFolder object it says:
>
> <error: an exception of type:
> {System.Runtime.InteropServices.COMException} occurred>.
>
> could this be the problem?
>
> Also the DisplayName is set to IPM.Note.XXX. Is this ok? What is
> display name used for anyway?
>
> thanks,
>
> craig

Re: Publish form Issues
"spareway" <spareway[ at ]gmail.com> 1/23/2007 11:11:41 PM
I figured out a solution. The problem was with the second parameter of
publishform.

string
dllPath ;
object missing = System.Reflection.Missing.Value;
Ol.MailItem theItem;
Ol.FormDescription theDesc;

dllPath = GetAssemblyPath();
//Environment.GetFolderPath(Environment.SpecialFolder.Personal)
theItem = (Ol.MailItem)
this.OutlookApp.CreateItemFromTemplate(dllPath + formPath, missing);
theDesc = (Ol.FormDescription) theItem.FormDescription;
theDesc.DisplayName = formName;

theDesc.PublishForm(Ol.OlFormRegistry.olPersonalRegistry,missing );
theItem.Close(Ol.OlInspectorClose.olDiscard);

Marshal.ReleaseComObject(theItem);
Marshal.ReleaseComObject(theDesc);



On Jan 15, 1:24 pm, "Ken Slovak - [MVP - Outlook]"
<kenslo...[ at ]mvps.org> wrote:
[Quoted Text]
> A problem with the Inbox would definitely be a problem with your code.
> However, I don't know what the UserPermissions property is in the Inbox
> folder, it's not an exposed property in the Outlook object model.
>
> DisplayName defaults to the custom MessageClass unless you enter a different
> string for that property when the custom form is published. It's not an
> important property for anything other than what shows up in the custom forms
> manager.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> "spareway" <spare...[ at ]gmail.com> wrote in messagenews:1168882946.044337.200400[ at ]v45g2000cwv.googlegroups.com...
>
>
>
> > Hi Ken,
>
> > All my objects look ok, except for the inBoxFolder. I am not sure if
> > this is an issue but when i look at the UserPermissions property of the
> > inBoxFolder object it says:
>
> > <error: an exception of type:
> > {System.Runtime.InteropServices.COMException} occurred>.
>
> > could this be the problem?
>
> > Also the DisplayName is set to IPM.Note.XXX. Is this ok? What is
> > display name used for anyway?
>
> > thanks,
>
> > craig- Hide quoted text -- Show quoted text -

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net