Options

Outlook Handler description

jkissjkiss Member Posts: 9
Hi,
I am trying to create a task in Outlook. I used the a similair metod like in CU397, "NewMessage", but using OTask object instead of OSendMail.

.....
OTask.Subject := Subject;
OTask.DueDate := WORKDATE;
OTask.Body := Body;
TaskSaved := OTask.Save;

the save metod generates an error:
"There is no IMessage object assigned to this Item"

Any trials to create, assign etc. to OTask object was without any success.

Is there a "Developer guide", Help or any description how to use the OHandler.dll?

Comments

  • WaldoWaldo Member Posts: 3,412
    IMHO you should not use the Handler. Just use the outlook automation. Then you get code like this:
    CLEAR(MSOutlookApp);
    CLEAR(MSOutlookNameSpace);
    CLEAR(MSOutlookRecepient);
    CLEAR(MSOutlookMAPIFolder);
    CLEAR(MSOutlookTaskItem);
    
    CLEAR(lrecPlanningLine);
    lrecPlanningLine.GET("Planning Line Issue No.", "Planning Line Job No.", "Planning Line Entry No.");
    
    IF ISCLEAR(MSOutlookApp) THEN CREATE(MSOutlookApp);
    
    MSOutlookNameSpace := MSOutlookApp.GetNamespace('MAPI');
    MSOutlookRecepient := MSOutlookNameSpace.CreateRecipient(lrecPlanningLine."Resource No."); //Name used in mailserver
    MSOutlookRecepient.Resolve; 
    MSOutlookMAPIFolder := MSOutlookNameSpace.GetSharedDefaultFolder(MSOutlookRecepient, 13);  // 13: constant for Default Taskfolder.
     
    MSOutlookTaskItem := MSOutlookApp.CreateItem(3);   // 3: Constant for Taskitem.
    
    cduPlanningOutlookFunctions.fctFillMSOutlookTask(MSOutlookTaskItem, lrecPlanningLine, FALSE);
    MSOutlookTaskItem.Save;
    
    lrecPlanningLine.VALIDATE("Task Entry ID (Outlook)", MSOutlookTaskItem.EntryID);
    lrecPlanningLine.VALIDATE("Synchron. Date (Outlook)", WORKDATE);
    lrecPlanningLine.VALIDATE("Synchron. Time (Outlook)", TIME);
    lrecPlanningLine.VALIDATE("Task Exported (Outlook)", TRUE);
    lrecPlanningLine.MODIFY(FALSE); 
    MSOutlookTaskItem.Close(0);
    CLEAR(MSOutlookApp);
    

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • jkissjkiss Member Posts: 9
    Thank you, it works....
    But...the initial idea was to send an assigned task. With tihs metod there are two "security" dialog windows opened from outlook:
    "a porgram is trying to access e-mail.....blah blah"
    and when sending the task:
    "a program is trying to automaticlaly send e-mail...."

    The user have to click both. Therefore I prefer the OHandler, where the extended MAPI is wrapped and will work without those inconvient dialogs....

    Any other ideas?
  • WaldoWaldo Member Posts: 3,412
    Hm,

    I know there is something like "clickyes.exe":
    http://www.google.be/search?hl=nl&q=clickyes.exe&meta=
    May be this can be helpful?

    Further, there are some registry hacks you can apply to avoid these messages, but you'll have to google some more...

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • jkissjkiss Member Posts: 9
    In a meantime I partialy solved the problem:
    SalesPerson.GET('XX');
    
    OLAppMgmt.SetCurrentSalesperson(SalesPerson);
    OLAppMgmt.GetApplication(OApplication);
    OLAppMgmt.InitializeTasksFolder(SalesPerson,FALSE);
    
    OLTasks := OApplication.OTasks;
    OLTask := OLTasks.Add;
    
    OLTask.Subject := Subject;
    OLTask.DueDate := WORKDATE;
    OLTask.Body := Body;
    
    OLTask.Save;
    
    

    if the salesperson has filled the OL synchornization fields, this code creates a task, without any warnings. But the OLTask object does not know the "Assign" metod and "Recipients" property :-(
    Waldo: your solution win !
  • WaldoWaldo Member Posts: 3,412
    :D

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • jkissjkiss Member Posts: 9
    Solved:
    I found a nice and free utility:
    http://www.mapilab.com/outlook/security/
    "Advanced Security for Outlook" solves the security windows. In first attempt it catches the "violator", the user can manulaly and permanently allow or deny access and by the next call, there are no annoying windows :-)
  • WaldoWaldo Member Posts: 3,412
    Are both warnings disappeared?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • jkissjkiss Member Posts: 9
    YES! =D>
Sign In or Register to comment.