![]() |
Opening PST-File with AddStoreEx removes Display Name
Hi,
I am adding a PST-file with the following code; Dim PSTFileName, Application, objName, PSTFile, fso pstFileName = "%s" Set Application = CreateObject("Outlook.Application") Set objName = Application.GetNamespace("MAPI") Set fso = CreateObject("Scripting.FileSystemObject") Set PSTFile = fso.GetFile(pstFileName) ' Second argument is Type (1=Default,2=Unicode,3=Ansi) objName.AddStoreEx PSTFile, %d if Err 0 Then WScript.StdOut.WriteLine "Success=F" WScript.StdErr.WriteLine "ErrorNumber=" & Err.Number WScript.StdErr.WriteLine "ErrorDescription=" & Err.Description WScript.StdErr.WriteLine "ErrorSource=" & Err.Source WScript.Quit 1 else WScript.StdOut.WriteLine "Success=T" WScript.Quit 0 End if %s is the file system path to the file. If I previously have defined a Display Name for my PST-file in outlook it seems as that display name is replaced with the default "Personal Folders" when viewing the file opened with the above code in Outlook. Am I doing something wrong somewhere, or is this the default behaviour for AddStoreEx? Best Regards Tobias |
Opening PST-File with AddStoreEx removes Display Name
On 31 Mar, 08:52, "Michael Bauer [MVP - Outlook]"
wrote: I can't repro that. My guess: AddStoreEx' first argument is a Variant and expects the file name, but you pass a Scripting File object to it. Even if that's not the error in this case, due to this Variant issue you always should explicitly write the property name instead of relying on any defaults. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Quick-Cats - The most effective way to assign Outlook categories: http://www.shareit.com/product.html?...4&languageid=1 (German:http://www.VBOffice.net/product.html?pub=6) Am 30 Mar 2007 02:09:01 -0700 schrieb : Hi, I am adding a PST-file with the following code; Dim PSTFileName, Application, objName, PSTFile, fso pstFileName = "%s" Set Application = CreateObject("Outlook.Application") Set objName = Application.GetNamespace("MAPI") Set fso = CreateObject("Scripting.FileSystemObject") Set PSTFile = fso.GetFile(pstFileName) ' Second argument is Type (1=Default,2=Unicode,3=Ansi) objName.AddStoreEx PSTFile, %d if Err 0 Then WScript.StdOut.WriteLine "Success=F" WScript.StdErr.WriteLine "ErrorNumber=" & Err.Number WScript.StdErr.WriteLine "ErrorDescription=" & Err.Description WScript.StdErr.WriteLine "ErrorSource=" & Err.Source WScript.Quit 1 else WScript.StdOut.WriteLine "Success=T" WScript.Quit 0 End if %s is the file system path to the file. If I previously have defined a Display Name for my PST-file in outlook it seems as that display name is replaced with the default "Personal Folders" when viewing the file opened with the above code in Outlook. Am I doing something wrong somewhere, or is this the default behaviour for AddStoreEx? Best Regards Tobias- Dölj citerad text - - Visa citerad text - Thanks for your reply, I've reproduced it on a few XP SP2 clients running O2K3, pretty standard installations with these instructions; 1. Create a new PST file 2. Accept the defaults, set the display name to something other than the default, for example "Test folder 1" 3. Right click the Personal Folder in the folder pane, choose "Close" 4. Map the PST using the above script 5. Open outlook and check what the displayname is. The above yielded "Personal Folders" on all installations i've tried with. |
Opening PST-File with AddStoreEx removes Display Name
Did you try my suggestion to explicitly pass the name instead of an object to the function? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Quick-Cats - The most effective way to assign Outlook categories: http://www.shareit.com/product.html?...4&languageid=1 (German: http://www.VBOffice.net/product.html?pub=6) Am 2 Apr 2007 01:33:03 -0700 schrieb : On 31 Mar, 08:52, "Michael Bauer [MVP - Outlook]" wrote: I can't repro that. My guess: AddStoreEx' first argument is a Variant and expects the file name, but you pass a Scripting File object to it. Even if that's not the error in this case, due to this Variant issue you always should explicitly write the property name instead of relying on any defaults. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Quick-Cats - The most effective way to assign Outlook categories: http://www.shareit.com/product.html?...4&languageid=1 (German:http://www.VBOffice.net/product.html?pub=6) Am 30 Mar 2007 02:09:01 -0700 schrieb : Hi, I am adding a PST-file with the following code; Dim PSTFileName, Application, objName, PSTFile, fso pstFileName = "%s" Set Application = CreateObject("Outlook.Application") Set objName = Application.GetNamespace("MAPI") Set fso = CreateObject("Scripting.FileSystemObject") Set PSTFile = fso.GetFile(pstFileName) ' Second argument is Type (1=Default,2=Unicode,3=Ansi) objName.AddStoreEx PSTFile, %d if Err 0 Then WScript.StdOut.WriteLine "Success=F" WScript.StdErr.WriteLine "ErrorNumber=" & Err.Number WScript.StdErr.WriteLine "ErrorDescription=" & Err.Description WScript.StdErr.WriteLine "ErrorSource=" & Err.Source WScript.Quit 1 else WScript.StdOut.WriteLine "Success=T" WScript.Quit 0 End if %s is the file system path to the file. If I previously have defined a Display Name for my PST-file in outlook it seems as that display name is replaced with the default "Personal Folders" when viewing the file opened with the above code in Outlook. Am I doing something wrong somewhere, or is this the default behaviour for AddStoreEx? Best Regards Tobias- Dölj citerad text - - Visa citerad text - Thanks for your reply, I've reproduced it on a few XP SP2 clients running O2K3, pretty standard installations with these instructions; 1. Create a new PST file 2. Accept the defaults, set the display name to something other than the default, for example "Test folder 1" 3. Right click the Personal Folder in the folder pane, choose "Close" 4. Map the PST using the above script 5. Open outlook and check what the displayname is. The above yielded "Personal Folders" on all installations i've tried with. |
Opening PST-File with AddStoreEx removes Display Name
On 2 Apr, 12:06, "Michael Bauer [MVP - Outlook]"
wrote: Did you try my suggestion to explicitly pass the name instead of an object to the function? -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Quick-Cats - The most effective way to assign Outlook categories: http://www.shareit.com/product.html?...4&languageid=1 (German:http://www.VBOffice.net/product.html?pub=6) Am 2 Apr 2007 01:33:03 -0700 schrieb : On 31 Mar, 08:52, "Michael Bauer [MVP - Outlook]" wrote: I can't repro that. My guess: AddStoreEx' first argument is a Variant and expects the file name, but you pass a Scripting File object to it. Even if that's not the error in this case, due to this Variant issue you always should explicitly write the property name instead of relying on any defaults. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Quick-Cats - The most effective way to assign Outlook categories: http://www.shareit.com/product.html?...4&languageid=1 (German:http://www.VBOffice.net/product.html?pub=6) Am 30 Mar 2007 02:09:01 -0700 schrieb : Hi, I am adding a PST-file with the following code; Dim PSTFileName, Application, objName, PSTFile, fso pstFileName = "%s" Set Application = CreateObject("Outlook.Application") Set objName = Application.GetNamespace("MAPI") Set fso = CreateObject("Scripting.FileSystemObject") Set PSTFile = fso.GetFile(pstFileName) ' Second argument is Type (1=Default,2=Unicode,3=Ansi) objName.AddStoreEx PSTFile, %d if Err 0 Then WScript.StdOut.WriteLine "Success=F" WScript.StdErr.WriteLine "ErrorNumber=" & Err.Number WScript.StdErr.WriteLine "ErrorDescription=" & Err.Description WScript.StdErr.WriteLine "ErrorSource=" & Err.Source WScript.Quit 1 else WScript.StdOut.WriteLine "Success=T" WScript.Quit 0 End if %s is the file system path to the file. If I previously have defined a Display Name for my PST-file in outlook it seems as that display name is replaced with the default "Personal Folders" when viewing the file opened with the above code in Outlook. Am I doing something wrong somewhere, or is this the default behaviour for AddStoreEx? Best Regards Tobias- Dölj citerad text - - Visa citerad text - Thanks for your reply, I've reproduced it on a few XP SP2 clients running O2K3, pretty standard installations with these instructions; 1. Create a new PST file 2. Accept the defaults, set the display name to something other than the default, for example "Test folder 1" 3. Right click the Personal Folder in the folder pane, choose "Close" 4. Map the PST using the above script 5. Open outlook and check what the displayname is. The above yielded "Personal Folders" on all installations i've tried with.- Dölj citerad text - - Visa citerad text - I were not able to test previously, and should have awaited to send a reply until I had, since your suggestion solved my issue :) I get the correct display name using the below snippet (pstFileName is the file system path to my PST file) Set Application = CreateObject("Outlook.Application") Set objName = Application.GetNamespace("MAPI") ' Second argument is Type (1=Default,2=Unicode,3=Ansi) objName.AddStoreEx pstFileName, 3 Thanks for your assistance! |
All times are GMT +1. The time now is 11:18 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com