Outlook form is not always maximized



Hi,
I am hoping this is the right forum for this question; if not, please let me
know where it would be more appropriate.

I am using Outlook Object Model in C# to create a Task or an Appointment
object and pre-fill it with user information. Once all the info is setup, I
pop up the Outlook form for the user to complete, and save (or cancel) into
their outlook. This is what the code looks like:

Outlook.ApplicationClass oApp = null;

Outlook.MAPIFolder oTaskFolder = null;

Outlook.TaskItemClass oTask = null;

try {

// setup outlook objects

oApp = new Outlook.ApplicationClass();

oTaskFolder = (Outlook.MAPIFolder)oApp.GetNamespace(
"MAPI" ).GetDefaultFolder( Outlook.OlDefaultFolders.olFolderTasks);

oTask = (Outlook.TaskItemClass)oTaskFolder.Items.Add( "IPM.Task" );

// setup task properties

oTask.Subject = "Call ";

oTask.StartDate = DateTime.Now.AddDays(1);

oTask.DueDate = oTask.StartDate.AddMinutes(15);

// Reminders off by default.

oTask.ReminderSet = false;

// Set Outlook properties, if not available, create the property, then set
it.

try {

oTask.UserProperties.Item( "ACTIVITYCODE" ).Value = iCode.ToString();

}

catch {

oTask.UserProperties.Add( "ACTIVITYCODE",
Outlook.OlUserPropertyType.olNumber, System.Reflection.Missing.Value,
System.Reflection.Missing.Value );

oTask.UserProperties.Item( "ACTIVITYCODE" ).Value = iCode;

}

try {

oTask.UserProperties.Item("ACCOUNTID").Value = strAccountID;

oTask.UserProperties.Item("CONTACTID").Value = strContactID;

oTask.UserProperties.Item("OPPORTUNITYID").Value = strOpportunityID;

}

catch{}


}

oTask.Display( false );



The problem is that sometimes, if Outlook is minimized, the form doesn't
"pop-up" but stays minimized, and flashes in the task bar. I need to force
it to always pop-up. Using Windows API is not helping:

// attempt to locate outlook window and focus on it.

string sText = oTask.Subject + " - Task ";

IntPtr hwnd = FindWindow( null, sText );

ShowWindow( hwnd, 9);



Is there anything I can do to guarantee that the window will be placed on
top and activated?



TIA

Alex


.



Relevant Pages

  • >>>> SETUP OUTLOOK <<<<
    ... Outlook Express Setup ... Wlm Mail Setup For Outlook 2003 ... Yahoo Setup Vista Microsoft Outlook ...
    (rec.travel.marketplace)
  • Re: Email....what to do part2 :)
    ... I was looking at the setup of outlook on the clients computer. ... IT ACT Houston - ACT Dallas ... >>> on the server. ...
    (microsoft.public.windows.server.sbs)
  • RE: Outlook client setup
    ... I use the user and computer setup wizard just like I always do. ... except they wouldn't install Outlook. ... > Thank you for posting to the SBS Newsgroup. ... > Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Outlook access to Exchange in different domain
    ... We recently had a customer request ... we setup Exchange access from one site to another site ... password prompts this would cause each time Outlook is launched. ... Setup Trusts (we don't have control or access to Domain B and the IT guy ...
    (microsoft.public.windows.server.sbs)
  • Re: Outlook access to Exchange in different domain
    ... Outlook over the Internet but wanted to avoid the constant ... Setup Trusts (we don't have control or access to Domain ... <3) Use Outlook over site-to-site VPN. ... The only concerns we have now is maintaining the host files ...
    (microsoft.public.windows.server.sbs)

Loading