Sue,
thanks for the reply. Here it goes..
Outlook.Application app = new Application();
TaskItem item = null;
item = (TaskItem)app.CreateItem(OlItemType.olTaskItem);
item.subject = ...
item.MessageClass = "IPM.Task.MyCustomForm";
item.Save();
this code adds the item correctly but when i open the task for view my
custom form it just opens the default form. If i close and open outlook
applicaiton, the tasks now open in the intended "MyCustomForm".
Right now i've saved the form as a Outlook template and use the following
code.
Outlook.ApplicationClass appClass = new ApplicaitonClass():
Outlook.NameSpace ns = appClass.GetNameSpace("MAPI);
Outlook.MAPIFolder oTaskItems =
ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
item =
(TaskItem)app.CreateItemFromTemplate("C:\myformTemplate.oft",oTaskItems);
item.subject = ...
item.MessageClass = "IPM.Task.MyCustomForm";
item.Save();
Using this code and adding the AllowActivexOneOffForms registry entry seems
to be working correctly. But i wanted to have the code piece #1 to be working
correctly. The forms are obviously published.
hope this helps
thanks
"Sue Mosher [MVP-Outlook]" wrote:
> Maybe you could show a code snippet to illustrate how you're creating the tasks. If you want them to use a custom form, you should be using a published form and creating the items with Add method on the target folder's Items collection.
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
>
> "back2grid" <(E-Mail Removed)> wrote in message news:9DBEB1BD-5251-41D8-B6B0-(E-Mail Removed)...
> > Hi,
> > I have what seems to be a strange problem. Firstly i created a add-in in
> > vs.net that adds new tasks for a user from a project management app. In order
> > to view custom data from the external app i've created a custom form. This
> > form contains basically a ActiveX control (written in .NET C#). When the
> > item(s) are
> > added, the message class is set to this custom form. The problem i'm seeing
> > is
> > that immediately after my add-in loads the tasks, and i click open a task,
> > the default form shows up instead of custom form. Now If i close my outlook
> > app (not just the item) and start it up again and then open the same task
> > item, i get the task in my custom form.
> > To work around i create a outlook template file of my custom form. i then
> > add items by using the createitemfromtemplate function. After adding the
> > ActiveAllowOneOffForms with DWORD set to 1. i get everything working smoothly.
> >
> > Why is outlook not loading the custom form for the first time. i would like
> > to avoid the registry entry.
> >
> > Anybody seen this issue before.
> >
> > thanks
> >
>