This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Outlook, VBscript and M-Files handler

Former Member
Former Member
Hello,

I need some help please. I need to know how to handle Outlook from M-Files handler '' for my users, clearly i need to generate a task in outlook.
I try it out from M-Files, direct from Windows in many maners, and it works fine. But not from M-Files directly, for example i dont get the namespace.
Can someone help me please? Here, The code that i have been used:
Const olTaskItem = 3
wstartDate = Now + 1
wdueDate = Now + 30

Set OutlookApp = CreateObject("Outlook.Application")
Set oItems = OutlookApp.CreateItem(olTaskItem)

With oItems
.Subject = "Ma troisième tache"
.StartDate = wstartDate
.DueDate = wdueDate
.Body = "Mon message Mon message Mon message Mon message"
.Categories = "M-Files"
.Save
End With

Set oItems = Nothing
Set OutlookApp = Nothing
Parents
  • Former Member
    Former Member
    (at first, sorry for my bad english...)
    I have two samples that i use with MS Office and our new UI Extended. At first, ensure that you have the good rights on your MS Windows side.
    The first sample is for the ShellUI and I create Menu commands in the ContextMenu and in the Taskpane. This commands (if activated) create an simple Excel Book and an simple Outlook Task.

    function OnNewShellUI( shellUI )
    {
    // Return event handlers as a closure.
    return {
    OnNewShellFrame: function( shellFrame ) {
    // Handle the OnNewShellFrame event of ShellUI.
    return {
    // OnStarted of the NewShellFrame
    OnStarted: function() {
    // Create menus only if a TaskPane is available. I avoid so the Popup windows case.
    if (shellFrame.TaskPane.Available) {
    // Declare sample Menu command
    var commandId = shellFrame.Commands.CreateCustomCommand( "~TEST Outlook~" );
    // Menu command added to the context Menu of the NewShellFrame.
    // See the UI Help for the many options...
    shellFrame.Commands.AddCustomCommandToMenu(commandId, MenuLocation_ContextMenu_BeforeWindowsCommands, 0 );
    // Menu command added to the TaskPane of the NewShellFrame
    // See the UI Help for the many options...
    shellFrame.TaskPane.AddCustomCommandToGroup( commandId, TaskPaneGroup_ViewAndModify, 0 );
    // Add custom command handler on your Menu command.
    shellFrame.Commands.Events.OnCustomCommand = function( activatedCommandId ) {
    // If the activated menucommand is my command
    if( activatedCommandId == commandId )
    {
    // Sample 1: create an Excel Book
    var Excel, Book;
    Excel = new ActiveXObject("Excel.Application");
    Excel.Visible = true;
    Book = Excel.Workbooks.Add()
    Book.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
    Book.SaveAs("C:\TEST.XLS");
    Excel.Application.Quit();

    // Sample 2: create an Outlook Task
    var Outlook;
    Outlook = new ActiveXObject("Outlook.Application");
    var objNS = Outlook.Session
    // Here 'personne' is my outlook profile name - Take your own...
    objNS.Logon ("personne", "", 0, 1)
    // create Outlook Task with some informations
    var oItem = Outlook.CreateItem(3);
    oItem.Subject = "tache 4";
    oItem.Body = "titititi titit iti tititi tititit iti";
    oItem.Categories = "M-Files";
    oItem.Save();
    }
    }
    }
    }
    };
    }
    };
    }


    In the next hour, I post an sample with the VaultUI that is more interresting for Vault Object manipulation.

    I hope you understand my horrible english. See you later...
Reply
  • Former Member
    Former Member
    (at first, sorry for my bad english...)
    I have two samples that i use with MS Office and our new UI Extended. At first, ensure that you have the good rights on your MS Windows side.
    The first sample is for the ShellUI and I create Menu commands in the ContextMenu and in the Taskpane. This commands (if activated) create an simple Excel Book and an simple Outlook Task.

    function OnNewShellUI( shellUI )
    {
    // Return event handlers as a closure.
    return {
    OnNewShellFrame: function( shellFrame ) {
    // Handle the OnNewShellFrame event of ShellUI.
    return {
    // OnStarted of the NewShellFrame
    OnStarted: function() {
    // Create menus only if a TaskPane is available. I avoid so the Popup windows case.
    if (shellFrame.TaskPane.Available) {
    // Declare sample Menu command
    var commandId = shellFrame.Commands.CreateCustomCommand( "~TEST Outlook~" );
    // Menu command added to the context Menu of the NewShellFrame.
    // See the UI Help for the many options...
    shellFrame.Commands.AddCustomCommandToMenu(commandId, MenuLocation_ContextMenu_BeforeWindowsCommands, 0 );
    // Menu command added to the TaskPane of the NewShellFrame
    // See the UI Help for the many options...
    shellFrame.TaskPane.AddCustomCommandToGroup( commandId, TaskPaneGroup_ViewAndModify, 0 );
    // Add custom command handler on your Menu command.
    shellFrame.Commands.Events.OnCustomCommand = function( activatedCommandId ) {
    // If the activated menucommand is my command
    if( activatedCommandId == commandId )
    {
    // Sample 1: create an Excel Book
    var Excel, Book;
    Excel = new ActiveXObject("Excel.Application");
    Excel.Visible = true;
    Book = Excel.Workbooks.Add()
    Book.ActiveSheet.Cells(1,1).Value = "This is column A, row 1";
    Book.SaveAs("C:\TEST.XLS");
    Excel.Application.Quit();

    // Sample 2: create an Outlook Task
    var Outlook;
    Outlook = new ActiveXObject("Outlook.Application");
    var objNS = Outlook.Session
    // Here 'personne' is my outlook profile name - Take your own...
    objNS.Logon ("personne", "", 0, 1)
    // create Outlook Task with some informations
    var oItem = Outlook.CreateItem(3);
    oItem.Subject = "tache 4";
    oItem.Body = "titititi titit iti tititi tititit iti";
    oItem.Categories = "M-Files";
    oItem.Save();
    }
    }
    }
    }
    };
    }
    };
    }


    In the next hour, I post an sample with the VaultUI that is more interresting for Vault Object manipulation.

    I hope you understand my horrible english. See you later...
Children
No Data