Property for All Users Shared Documents or CA?

6 views
Skip to first unread message

International Connections

unread,
Oct 30, 2003, 6:48:37 PM10/30/03
to
I'm hoping someone might be able to help me with these questions.
I have some files that have to be installed in "C:\Documents and
Settings\All Users\Shared Documents\" on XP and 2000 machines.

Is there a MSI property I can use to get the path of the All Users
Shared Documents folder?
(C:\Documents and Settings\All Users\Shared Documents\")
Under it, I need to create a folder named "Shared XXXProduct_Name" and
create other folders and install files.

If not, considering that the strings "Documents and Settings" and "All
Users" and "Shared Documents" will be different on different machines
depending of the language (French, German, Spanish…) is there a way to
pull this path from the registry using a custom action or...?

CommonFilesFolder Property
The installer sets the CommonFilesFolder property to the full path to
the Common Files folder for the current user.
But what about for ALL USERS Shared Documents?

Any help will be very welcomed.

I read the help topic "System Folder Properties" (Windows Installer
Version 2.0 Platform SDK Release: November 2001) but I was not able to
find such property.

Here are some of the properties I already used (ALLUSERS is set to 1):

ProgramMenuFolder property
The installer sets the ProgramMenuFolder property to the full path to
the Program Menu folder for the current user. If an "All Users"
profile exists and the ALLUSERS property is set, then this property is
set to the folder in the "All Users" profile.

AppDataFolder Property

MyPicturesFolder
C:\Documents and Settings\dgschnei\My Documents\My Pictures\

LocalAppDataFolder
C:\Documents and Settings\dgschnei\Local Settings\Application Data\

PersonalFolder
C:\Documents and Settings\dgschnei\My Documents\

Thank you in advance for your help.

Regards

Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html

http://gurleyalabama.contactez.net

Andreas Magnusson

unread,
Nov 3, 2003, 4:42:05 AM11/3/03
to
Well, if you need to create a CA to get to the folder name, the "correct"
function to call is SHGetFolderPath with the parameter
CSIDL_COMMON_DOCUMENTS.
The doc for the function can be found here:
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shgetfolderpath.asp

/Andreas
"International Connections" <assi...@contactez.net> wrote in message
news:9a3d4722.03103...@posting.google.com...


> I'm hoping someone might be able to help me with these questions.
> I have some files that have to be installed in "C:\Documents and
> Settings\All Users\Shared Documents\" on XP and 2000 machines.
>
> Is there a MSI property I can use to get the path of the All Users
> Shared Documents folder?
> (C:\Documents and Settings\All Users\Shared Documents\")
> Under it, I need to create a folder named "Shared XXXProduct_Name" and
> create other folders and install files.
>
> If not, considering that the strings "Documents and Settings" and "All
> Users" and "Shared Documents" will be different on different machines

> depending of the language (French, German, Spanish.) is there a way to

Kallely Sajan

unread,
Nov 4, 2003, 10:35:48 AM11/4/03
to
Create a custom action type 51 with Target as [%ALLUSERSPROFILE]
This will work in Win2K and newer machines.
--

Regards,
Sajan.

PS: Please don't send me direct emails, use the newsroom.

"International Connections" <assi...@contactez.net> wrote in message
news:9a3d4722.03103...@posting.google.com...

> I'm hoping someone might be able to help me with these questions.
> I have some files that have to be installed in "C:\Documents and
> Settings\All Users\Shared Documents\" on XP and 2000 machines.
>
> Is there a MSI property I can use to get the path of the All Users
> Shared Documents folder?
> (C:\Documents and Settings\All Users\Shared Documents\")
> Under it, I need to create a folder named "Shared XXXProduct_Name" and
> create other folders and install files.
>
> If not, considering that the strings "Documents and Settings" and "All
> Users" and "Shared Documents" will be different on different machines

> depending of the language (French, German, Spanish.) is there a way to

International Connections

unread,
Nov 6, 2003, 1:16:17 AM11/6/03
to
Sajan,

Thank you for your answer.
The [%ALLUSERSPROFILE%] gives me
C:\Documents and Settings\All Users\ unless I misunderstood I am still
missing the localized string for "Documents" or/and "Shared Documents"

I got the SHGetFolderPath(0, CSIDL_COMMON_DOCUMENTS Or
CSIDL_FLAG_CREATE, 0, SHGFP_TYPE_CURRENT, sPath) to work for me in a
VB exe.
sPath = Left(sPath, InStr(1, sPath, Chr(0)) - 1)

I get the correct path – I created a CA to run the EXE - up to there
it is fine.

But I am now trying to get the returned value sPath to be fed into the
MSI.

So I referenced the Microsoft Windows Installer Object Library into
the VB exe and I am now trying to use:

msiSession.Property("COMMONDOCProperty") = sPath

I also tried:
Dim msiSession As WindowsInstaller.Installer
Set msiSession = CreateObject("WindowsInstaller.Installer")
msiSession.Environment("COMMONDOCProperty") = sPath

COMMONDOCProperty is a property I created in the Property table.

But none of these are working, the returned value sPath is not fed in
the MSI so I still need help...

Thank you in advance and regards,

Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html
http://gurleyalabama.contactez.net

"Kallely Sajan" <saj...@hotmail.com> wrote in message news:<uDKdeluo...@TK2MSFTNGP09.phx.gbl>...


> Create a custom action type 51 with Target as [%ALLUSERSPROFILE]
> This will work in Win2K and newer machines.

International Connections

unread,
Nov 6, 2003, 1:39:56 AM11/6/03
to
Andreas,

Thank you for your answer.

I wish MSI would offer a property for that folder :O(

In VB6 I got it right in the languages (English, French, German,
Spanish, Italian...) using the Declared Function SHGetFolderPath and
the Private Constant CSIDL_COMMON_DOCUMENTS = &H2E
I get in return the spath localized value
C:\Documents and Settings\All Users\Documents
I then Referenced the Micosoft Windows Installer Objects into my VB
project and created the exe that gets the correct path.
So this is great...

But I am now trying to get the returned value Path to be fed into the
MSI.

I created a custom action and a property named COMMONDOCProperty

I tried without luck:
Dim msiSession As WindowsInstaller.Session


msiSession.Property("COMMONDOCProperty") = sPath

Set msiSession2 = Nothing

I also tried:
Dim msiSession As WindowsInstaller.Installer
Set msiSession = CreateObject("WindowsInstaller.Installer")
msiSession.Property("COMMONDOCProperty") = sPath

How can I feed the property COMMONDOCProperty (located in the Property
Table of the MSI) with the value returned from my EXE ?

Thank you again :O)

Regards
Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html
http://gurleyalabama.contactez.net

Andreas Magnusson" <andreas_c...@hotmail.com> wrote in message news:<uXGu$6eoDH...@TK2MSFTNGP09.phx.gbl>...

Kallely Sajan

unread,
Nov 6, 2003, 12:05:40 PM11/6/03
to
You can not use an exe type custom action for this as the current install
session will not be available inside the exe. You have to go for either a
script based or regular DLL based custom action. Few options are using the
SpecialFolders method of wscript.shell or get the paths from
HKLM\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
--

Regards,
Sajan.

PS: Please don't send me direct emails, use the newsroom.

"International Connections" <assi...@contactez.net> wrote in message

news:9a3d4722.03110...@posting.google.com...


> Sajan,
>
> Thank you for your answer.
> The [%ALLUSERSPROFILE%] gives me
> C:\Documents and Settings\All Users\ unless I misunderstood I am still
> missing the localized string for "Documents" or/and "Shared Documents"
>
> I got the SHGetFolderPath(0, CSIDL_COMMON_DOCUMENTS Or
> CSIDL_FLAG_CREATE, 0, SHGFP_TYPE_CURRENT, sPath) to work for me in a
> VB exe.
> sPath = Left(sPath, InStr(1, sPath, Chr(0)) - 1)
>

> I get the correct path - I created a CA to run the EXE - up to there

International Connections

unread,
Nov 17, 2003, 12:44:45 PM11/17/03
to
Thank you Sajan, and all,

Thank you for the information concerning SHGetFolderPath and
ALLUSERSPROFILE. But I will try to use the CSIDL_COMMON_APPDATA
instead of the CSIDL_COMMON_DOCUMENTS.

I was able to easily get the CSIDL_COMMON_APPDATA value but it seems
harder to get the CSIDL_COMMON_DOCUMENTS value using a simple
vbscript. I prefer keep the process as simple as it can be; so a
Custom Action in Vbscript seems the best way to get the value of
CSIDL_COMMON_APPDATA into the MSI in all localized natural languages.

For some reasons on our machines a very small number of special
folders are not easily available from vbscript. Unless somebody can
share a straight forward vbscript code to expose the
CSIDL_COMMON_DOCUMENTS &H2E, I will settle to use the
CSIDL_COMMON_APPDATA &H23
In conjunction with
CSIDL_PERSONAL C:\Documents and Settings\dgschnei\My Documents folder
and
CSIDL_APPDATA C:\Documents and Settings\dgschnei\Application Data
I should be fine.

You have been very helpful.
Regards,


Please don't send me direct emails, use the newsroom or go to
http://contactez.net/portfolio.html
http://gurleyalabama.contactez.net

"Kallely Sajan" <saj...@hotmail.com> wrote in message news:<#GuCEhIp...@TK2MSFTNGP12.phx.gbl>...

Reply all
Reply to author
Forward
0 new messages