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 - Using Contacts
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Public Folders Contact



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 20th 07, 04:55 AM posted to microsoft.public.outlook.contacts
William A. J.
external usenet poster
 
Posts: 10
Default Public Folders Contact

Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.
Ads
  #2  
Old March 20th 07, 02:31 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folders Contact

Each user could run a script to set the ShowAsOutlookAB property for that folder.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.

  #3  
Old March 21st 07, 03:53 AM posted to microsoft.public.outlook.contacts
William A. J.
external usenet poster
 
Posts: 10
Default Public Folders Contact

This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.


  #4  
Old March 21st 07, 01:29 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folders Contact

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.


  #5  
Old March 22nd 07, 06:08 AM posted to microsoft.public.outlook.contacts
William A. J.
external usenet poster
 
Posts: 10
Default Public Folders Contact

Hi Sue,

Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.


  #6  
Old March 22nd 07, 12:53 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folders Contact

The best way to find out is to try it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.


  #7  
Old March 28th 07, 01:12 AM posted to microsoft.public.outlook.contacts
William A. J.
external usenet poster
 
Posts: 10
Default Public Folders Contact

Hi Sue,

I got an error message while trying to run the script you gave me. It says
something like:
Line: 27
Char: 7
Error: Name redefined
Code: 800A0411
Source: Microsoft VBScript compilation error

It looks like there is a problem with objNS.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

The best way to find out is to try it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.



  #8  
Old March 28th 07, 03:03 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folders Contact

Sorry, I left out a couple of statements:

If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
Else
Set objNS = objOL.GetNamespace("MAPI")
End If

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

I got an error message while trying to run the script you gave me. It says
something like:
Line: 27
Char: 7
Error: Name redefined
Code: 800A0411
Source: Microsoft VBScript compilation error

It looks like there is a problem with objNS.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

The best way to find out is to try it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.



  #9  
Old March 29th 07, 07:24 AM posted to microsoft.public.outlook.contacts
William A. J.
external usenet poster
 
Posts: 10
Default Public Folders Contact

Hi Sue,

I got the same error =/

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Sorry, I left out a couple of statements:

If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
Else
Set objNS = objOL.GetNamespace("MAPI")
End If

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

I got an error message while trying to run the script you gave me. It says
something like:
Line: 27
Char: 7
Error: Name redefined
Code: 800A0411
Source: Microsoft VBScript compilation error

It looks like there is a problem with objNS.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

The best way to find out is to try it.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.




  #10  
Old March 29th 07, 01:24 PM posted to microsoft.public.outlook.contacts
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Public Folders Contact

So, what's the statement on line 27, the line where the code error occurred?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

I got the same error =/

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Sorry, I left out a couple of statements:

If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
Else
Set objNS = objOL.GetNamespace("MAPI")
End If

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"William A. J." wrote in message ...
Hi Sue,

I got an error message while trying to run the script you gave me. It says
something like:
Line: 27
Char: 7
Error: Name redefined
Code: 800A0411
Source: Microsoft VBScript compilation error

It looks like there is a problem with objNS.



Everything is done manually as the company does not a standard IT policy
yet. Outlook profile is created when a user logs on for the first time on a
PC. People do not usually move around. They stick with the same PC all the
time. Do you think the script you gave me would work on this kind of
environment?

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing

Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS

On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")

'set the root folder
Set fldr = objNS.Folders(aFolders(0))

'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err 0 Then Exit Function
Next
Set GetFolder = fldr
End Function

If you don't know the profile name, then use this Logon statement instead:

objNS.Logon "", "", True, True

"William A. J." wrote in message ...
This is what I have in mind. I prepare a script for user to run and
distribute it by Group Policy. Tell me if I am wrong. I just have to really
put aside the technical part from users. What script would you suggest for
this matter? To be honest I am a total newbie when it comes to Windows
scripting.

Thank you.

William A. J.

"Sue Mosher [MVP-Outlook]" wrote:

Each user could run a script to set the ShowAsOutlookAB property for that folder.

"William A. J." wrote in message ...
Hi,

Does anyone know how to set Public Folders Contact to be displayed on
Microsoft Outlook Address book automatically without users having to enable
it on the properties of the contact?

Thank you in advance.

William A. J.




 




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
OL2k3 Automatically Adding Public Folders to 'Favorite Folders' list in Mail Ben Outlook - General Queries 0 October 4th 06 05:19 PM
How do I configure Public Folders to be default contact folders? RobinBaral Outlook - Using Contacts 2 September 27th 06 05:12 PM
How to open Public Folders 'Contact Form' using VBA mmattson Outlook and VBA 1 May 17th 06 11:06 PM
What happens if multiple users update a contact stored in public folders? [email protected] Outlook - Using Forms 1 March 30th 06 04:18 PM
Searching a contact folder created in Public Folders fails. Ben McKellar Outlook - Using Contacts 0 March 12th 06 11:26 PM


All times are GMT +1. The time now is 08:52 PM.


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.