![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
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 |
#3
|
|||
|
|||
![]()
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. |
#4
|
|||
|
|||
![]() 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. |
#5
|
|||
|
|||
![]()
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! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Viewing pst file as default when opening Outlook 2003 | Scuba Steve | Outlook - General Queries | 1 | February 7th 07 08:22 PM |
Outlook 2000 pst file (2.1 gig) not opening in Outlook 2003 | Kay Anderson | Outlook - Installation | 1 | December 14th 06 09:35 AM |
Advanced - Adding a Secondary pst file without opening Outlook. | Any help would be appreciated | Outlook - Installation | 1 | August 30th 06 07:30 PM |
"not a personal folders file (.pst)" opening backup Outlook.pst | JimmyZ | Outlook - Installation | 10 | July 28th 06 04:32 PM |
Trouble opening an Outlook .pst file; not recognizing as .pst! | MN Rhino | Outlook - Installation | 6 | May 9th 06 12:59 AM |