none
Install oft files into end-users personal forms library automatically per profile. RRS feed

  • Question

  • Hi all,

    Thanks in advance for any advice you can give me

    I have an .oft file that successfully installs via a VB script. What I would like to do is find some way to automate the process, ideally during the Outlook configuration so that as each profile is created this form is installed. I have considered adding the files to the installation using the OCT, but I can't figure out how to launch the script.

    Any ideas?

    Thanks,

    Robin


    • Edited by MISRobin2 Monday, April 23, 2012 11:05 PM
    Monday, April 23, 2012 10:48 PM

Answers

  • If an OFT or any custom form has code in it the code will not execute unless the form is published. I usually include any OFT files as resources in my addin projects, then on startup I check to see if the form has been published and if not I publish it. That way I can also set the form as the default for specific folders, and code behind the forms will run. Also, that way I can create new items from the form by specifying the custom MessageClass for the form when I create an instance.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Tom_Xu MSFT" <=?utf-8?B?VG9tX1h1IE1TRlQ=?=> wrote in message news:de7e2b3b-4b28-4f65-ad86-6ca73b709e25...

    Hi MISRobin2,

    You are able to creat a Outlook add-in and embed you oft as a resource in add-in project. Then you can invoke it any time.

    Here have some example:

    This is a Resource which I embed it in my project:

    It is Properties.Resource.TaskIssue in my project.

    The follow snippet will invoke it.

                    string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyOfficeIssue";
                    if(!File.Exists(tempPath + "\\tempTaskIssue.oft"))
                    {
                        byte[] resource = Properties.Resources.TaskIssue;
                        using (FileStream fs = new FileStream(tempPath + "\\tempTaskIssue.oft", FileMode.Create))
                        {
                            fs.Write(resource, 0, resource.Length);
                            fs.Close();
                        }
                    }
                    Outlook.TaskItem task = ola.CreateItemFromTemplate(tempPath + "\\tempTaskIssue.oft",traget);

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Ken Slovak MVP - Outlook
    Wednesday, April 25, 2012 1:32 PM
    Moderator

All replies

  • Hi MISRobin2,

    Thanks for posting in the MSDN Forum.

    It's based on my experience that oft file is a template for outlook item. It doesn't need "install" action. Just "copy or cut" needs. So I would recommend you show me your VB script to clarify your goal.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, April 24, 2012 3:07 AM
    Moderator
  • Hi Tom,

    Thanks for replying! Below you will find the VBscript. This script works well, but each user on the computer must run it individually in order for it to work. This has become an issue for us, and I would like to figure out how to automate it as part of the initial Outlook configuration when a new profile is created.

    Thanks,

    Robin

    ' script to install eForms in local registry
    '-------------------------------

    dim filesys, strPath
    set filesys=CreateObject("Scripting.FileSystemObject")
    strPath = filesys.GetAbsolutePathName("Cand-ENU.oft")
    strName = "CommVault.Galaxy.ToBeArchived"

    Dim objOL       ' As Outlook.Application
    Dim objItem     ' As Outlook.ContactItem
    Dim objFD       ' As Outlook.FormDescription
    Const olPersonalRegistry = 2
    Const olDiscard = 1
       
    Set objOL = CreateObject("Outlook.Application")
    Set objItem = objOL.CreateItemFromTemplate(strPath)

    Set objFD = objItem.FormDescription
    With objFD
        .DisplayName = strName
        .PublishForm olPersonalRegistry
    End With
    objItem.Close olDiscard

    set filesys=CreateObject("Scripting.FileSystemObject")
    strPath = filesys.GetAbsolutePathName("LMCand-ENU.oft")
    strName = "CommVault.Galaxy.ToBeLocallyMigrated"

    Set objOL = CreateObject("Outlook.Application")
    Set objItem = objOL.CreateItemFromTemplate(strPath)

    Set objFD = objItem.FormDescription
    With objFD
        .DisplayName = strName
        .PublishForm olPersonalRegistry
    End With
    objItem.Close olDiscard
     
    set filesys=CreateObject("Scripting.FileSystemObject")
    strPath = filesys.GetAbsolutePathName("Stub-ENU.oft")
    strName = "CommVault.Galaxy.stub"
       
    Set objOL = CreateObject("Outlook.Application")
    Set objItem = objOL.CreateItemFromTemplate(strPath)

    Set objFD = objItem.FormDescription
    With objFD
        .DisplayName = strName
        .PublishForm olPersonalRegistry
    End With
    objItem.Close olDiscard
     
    Set objFD = Nothing
    Set objItem = Nothing
    Set objOL = Nothing
    Set strPath = Nothing
    Set strName = Nothing

    msgbox "3 Commvault Archiver eForms installed in Outlook Personal forms registry"

    Tuesday, April 24, 2012 2:57 PM
  • Hi MISRobin2,

    You are able to creat a Outlook add-in and embed you oft as a resource in add-in project. Then you can invoke it any time.

    Here have some example:

    This is a Resource which I embed it in my project:

    It is Properties.Resource.TaskIssue in my project.

    The follow snippet will invoke it.

                    string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyOfficeIssue";
                    if(!File.Exists(tempPath + "\\tempTaskIssue.oft"))
                    {
                        byte[] resource = Properties.Resources.TaskIssue;
                        using (FileStream fs = new FileStream(tempPath + "\\tempTaskIssue.oft", FileMode.Create))
                        {
                            fs.Write(resource, 0, resource.Length);
                            fs.Close();
                        }
                    }
                    Outlook.TaskItem task = ola.CreateItemFromTemplate(tempPath + "\\tempTaskIssue.oft",traget);

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 25, 2012 6:07 AM
    Moderator
  • If an OFT or any custom form has code in it the code will not execute unless the form is published. I usually include any OFT files as resources in my addin projects, then on startup I check to see if the form has been published and if not I publish it. That way I can also set the form as the default for specific folders, and code behind the forms will run. Also, that way I can create new items from the form by specifying the custom MessageClass for the form when I create an instance.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "Tom_Xu MSFT" <=?utf-8?B?VG9tX1h1IE1TRlQ=?=> wrote in message news:de7e2b3b-4b28-4f65-ad86-6ca73b709e25...

    Hi MISRobin2,

    You are able to creat a Outlook add-in and embed you oft as a resource in add-in project. Then you can invoke it any time.

    Here have some example:

    This is a Resource which I embed it in my project:

    It is Properties.Resource.TaskIssue in my project.

    The follow snippet will invoke it.

                    string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\MyOfficeIssue";
                    if(!File.Exists(tempPath + "\\tempTaskIssue.oft"))
                    {
                        byte[] resource = Properties.Resources.TaskIssue;
                        using (FileStream fs = new FileStream(tempPath + "\\tempTaskIssue.oft", FileMode.Create))
                        {
                            fs.Write(resource, 0, resource.Length);
                            fs.Close();
                        }
                    }
                    Outlook.TaskItem task = ola.CreateItemFromTemplate(tempPath + "\\tempTaskIssue.oft",traget);

    I hope it can help you.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us


    Ken Slovak MVP - Outlook
    Wednesday, April 25, 2012 1:32 PM
    Moderator