A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Opening PST-File with AddStoreEx removes Display Name



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 30th 07, 10:09 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 4
Default 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

  #2  
Old March 31st 07, 07:52 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Opening PST-File with AddStoreEx removes Display Name



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

  #3  
Old April 2nd 07, 09:33 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 4
Default 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.

  #4  
Old April 2nd 07, 11:06 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default 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.

  #5  
Old April 2nd 07, 01:14 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 4
Default 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!

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 06:56 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-2025 Outlook Banter.
The comments are property of their posters.