HighlanderSword Posted December 14, 2010 Posted December 14, 2010 Hello, Im using the outlook udf and am having issues when adding folders, I took the example #Include "C:\Work Data\Downloads\outlook\Outlook.au3" $oOutlook = _OutlookOpen() $xx = _OutlookFolderAdd($oOutlook,$olFolderInbox & "\Old\Missing\") The code snippet only creates the Old folder and NOT the subfolder underneath it ( Missing). I also want to be able to specify what PST folder to use to create the new folders in, so for example I have an opened PST in Outlook named examples, So How would I add the \Old\Missing folders to the root of the Example pst folder I have opened. I tried doing $xx = _OutlookFolderAdd($oOutlook,"Examples\Old\Missing\") $xx = _OutlookFolderAdd($oOutlook,"\Examples\Old\Missing\") $xx = _OutlookFolderAdd($oOutlook,"\\Examples\Old\Missing\") All failed with error code of 2 - inidcating it could not find the root folder" Please let me know if anyone has any ideas. Thanks Paul
Juvigy Posted December 15, 2010 Posted December 15, 2010 Have you tried to split $xx = _OutlookFolderAdd($oOutlook,$olFolderInbox & "\Old\Missing\") in 2 lines ? like $xx1 = _OutlookFolderAdd($oOutlook,$olFolderInbox & "\Old\") $xx2 = _OutlookFolderAdd($oOutlook,$olFolderInbox & "\Old\Missing\") as technically those are 2 folders you want to create.
HighlanderSword Posted December 15, 2010 Author Posted December 15, 2010 Hello, Yes that will create the 2 folders. Is there any way ti specify the PST folder to place it in ?
Juvigy Posted December 16, 2010 Posted December 16, 2010 There is a way but it is complicated and you will have to use CDO. It is not possible with the Outlook udf. You can check the CDO methods like: $objSession = ObjCreate("MAPI.Session") $objSession.Logon("","",False,False) $objInfoStores = $objSession.InfoStores FOR $element IN $objInfoStores $objTopFolder = $element.RootFolder $FolderID = $element.ID $Folders = $element.RootFolder.Folders ConsoleWrite($element.ID&@CRLF) ConsoleWrite($element.Name&@CRLF) NEXT This will get the ID's and Name's of all inbox's and pst's. You will need to have CDO installed. I have installed it from here: icrosoft Collaboration Data Objects 1.2.1 installer April 2006 © Microsoft Corporation. All Rights Reserved. The release notes for Microsoft Collaboration Data Objects 1.2.1 are available on the Release Notes Web page at http://go.microsoft.com/fwlink/?LinkId=178082.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now