Jump to content

Recommended Posts

Posted

I recently downloaded Wooltown's Outlook UDF and have been able to accomplish some things that I would have otherwise not been able to. (Thanks!). I would like to be able to create root folder in Outlook rather than folders under the Inbox. (In other words, I would like to be able to create a folder at the same level as Inbox. Here is my code to create the folder but it puts it under Inbox:

Outlook Folder Testing
#include "\\Server\Scripts\OLTest\Outlook\Outlook.au3"

$oOutlook = _OutlookOpen()
_OutlookFolderAdd($oOutlook, $olFolderInbox&"\MyFirstFolder")

If I modify the _OutlookFolderAdd line and remove the $olFolderInbox, then the function returns error 2. Any way that I can get to the root to add the folder? Thanks

Posted

It is not supported by the folder.add method .There are some other ways to create a root folder but it gets too complicated:

1) Create (or license) a MAPI information store that connects to the database and exposes the database details. See the tools listed at http://www.outlookcode.com/article.aspx?ID=25

2) Synchronize the database with a .pst file using the Replication API that Microsoft provides; see http://www.outlookcode.com/article.aspx?ID=37 for links to documentation and samples.

Posted

It is not supported by the folder.add method .There are some other ways to create a root folder but it gets too complicated:

1) Create (or license) a MAPI information store that connects to the database and exposes the database details. See the tools listed at http://www.outlookcode.com/article.aspx?ID=25

2) Synchronize the database with a .pst file using the Replication API that Microsoft provides; see http://www.outlookcode.com/article.aspx?ID=37 for links to documentation and samples.

Thank you for the suggestions. In the meantime, I have found a VBScript that will do this that isn't too complicated. I think I'll go that route

Posted

;//Create the Outlook Object
    $o_Outlook = ObjCreate("Outlook.Application")
    $oNamespace = $o_Outlook.GetNameSpace("MAPI")
    $oInbox = $oNamespace.GetDefaultFolder($olFolderInbox)
    $oFolders = $oInbox.Parent.Folders
    ;//Process SMS Valid Folder
    While 1
        ;//Set Folder Name Valid SMS's;
        ;$oSMSFolder = 0
        Global $oSMSFolder = ""
        For $oFolder In $oFolders
            If String($oFolder.Name) = $sSMSFolder Then
                $oSMSFolder = $oFolder
            EndIf
        Next
        ;//Checks for existing Folder otherwise Creates a new folder;
        If IsObj($oSMSFolder) Then
            If $Process = 0 Then
                MsgBox(262208, $Title, $Title & " Folder '" & $sSMSFolder & "' HAS BEEN CREATED", 30)
            EndIf
            ExitLoop
        ElseIf Not IsObj($oSMSFolder) Then
            $iReturn = MsgBox(262180, $Title, $Title & " CREATE Folder '" & $sSMSFolder & "' ?", $sMenuDuration)
            If $iReturn = 6 Then
                $oSMSFolder = $oFolders.Add($sSMSFolder)
                $Process = 0
                If Not IsObj($oSMSFolder) Then
                    MsgBox(64, $Title, "UNABLE to Create " & $Title & " Folder '" & @CRLF _
                             & $sSMSFolder & "' .", $sMenuDuration)
                    ExitLoop
                EndIf
            Else
                MsgBox(0, $Title, "Folder '" & $sSMSFolder & "' NOT CREATED", $sMenuDuration)
                ExitLoop
            EndIf
        EndIf
    WEnd

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...