Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - Using Contacts (http://www.outlookbanter.com/outlook-using-contacts/)
-   -   activate contact folder from public folder with "show this folder as email address book using a prf file (http://www.outlookbanter.com/outlook-using-contacts/21606-activate-contact-folder-public-folder.html)

Frankie K. July 24th 06 01:11 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
Hi,

i setup the mapi user profiles with a prf file, but i don't know a way
to activate to of my contact folder from my public folders for usage as
email address book.

I saw the following posting
http://groups.google.de/group/micros...a69054 caac72

but there are no specific instructions how i have to configure my
outlook.

I hope someone can help me.

Thank you in advance!

Best regards,
Frankie


Sue Mosher [MVP-Outlook] July 24th 06 02:35 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
That is not a setting you can manage with a .prf file. Each user would need to run a script to set the ShowAsOutlookAB property for the folder to 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

"Frankie K." wrote in message ups.com...
Hi,

i setup the mapi user profiles with a prf file, but i don't know a way
to activate to of my contact folder from my public folders for usage as
email address book.

I saw the following posting
http://groups.google.de/group/micros...a69054 caac72

but there are no specific instructions how i have to configure my
outlook.

I hope someone can help me.

Thank you in advance!

Best regards,
Frankie


Frankie K. July 24th 06 07:08 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
Thank you Sue,

i tested the following:

Sub ShowAsAddressBookChange()

Dim olApp As Outlook.Application
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder

Set olApp = Outlook.Application
'Create instance of namespace
Set nmsName = olApp.GetNamespace("Mapi")
Set fldFolder = nmsName.GetDefaultFolder(olFolderContacts)
'Display the folder as Outlook Address Book
fldFolder.ShowAsOutlookAB = True

End Sub

Works fine! But how can i set the path to my contact folder in my
public folder. Which objet can i use to set this path?

Thank you in advance!

Best regards,
Frank

Sue Mosher [MVP-Outlook] schrieb:

That is not a setting you can manage with a .prf file. Each user would need to run a script to set the ShowAsOutlookAB property for the folder to True.



Sue Mosher [MVP-Outlook] July 24th 06 07:55 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
To get a non-default folder, you need to walk the folder hierarchy starting with the Namespace.Folders collection or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164

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

"Frankie K." wrote in message ps.com...
Thank you Sue,

i tested the following:

Sub ShowAsAddressBookChange()

Dim olApp As Outlook.Application
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder

Set olApp = Outlook.Application
'Create instance of namespace
Set nmsName = olApp.GetNamespace("Mapi")
Set fldFolder = nmsName.GetDefaultFolder(olFolderContacts)
'Display the folder as Outlook Address Book
fldFolder.ShowAsOutlookAB = True

End Sub

Works fine! But how can i set the path to my contact folder in my
public folder. Which objet can i use to set this path?

Thank you in advance!

Best regards,
Frank

Sue Mosher [MVP-Outlook] schrieb:

That is not a setting you can manage with a .prf file. Each user would need to run a script to set the ShowAsOutlookAB property for the folder to True.



Frankie K. July 24th 06 09:48 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
Hi Sue,

if I run the code in Visual Editor it's ok but if i test it with a
double click as a vbs script i get Error 800A0401 line:2 character: 15

Can you help me once more, please?

Sub ShowAsAddressBookChange()
Dim olApp As Outlook.Application
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder

Set olApp = Outlook.Application
'Create instance of namespace
Set nmsName = olApp.GetNamespace("Mapi")
'Set fldFolder = GetFolder("Public Folders/All Public
Folders/Company/Sales")
'objNS.GetDefaultFolder(olFolderContacts)
Set fldFolder = GetFolder("Test")
'Display the folder as Outlook Address Book
fldFolder.ShowAsOutlookAB = True
End Sub

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For I = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(I))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function

Best regards
Frank


Sue Mosher [MVP-Outlook] July 24th 06 10:03 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
The VBScript language doesn't support data-typed variable declarations. Comment out all the ' As clauses and use CreateObject("Outlook.Application") to return an Outlook.Application object.

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

"Frankie K." wrote in message ups.com...
Hi Sue,

if I run the code in Visual Editor it's ok but if i test it with a
double click as a vbs script i get Error 800A0401 line:2 character: 15

Can you help me once more, please?

Sub ShowAsAddressBookChange()
Dim olApp As Outlook.Application
Dim nmsName As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder

Set olApp = Outlook.Application
'Create instance of namespace
Set nmsName = olApp.GetNamespace("Mapi")
'Set fldFolder = GetFolder("Public Folders/All Public
Folders/Company/Sales")
'objNS.GetDefaultFolder(olFolderContacts)
Set fldFolder = GetFolder("Test")
'Display the folder as Outlook Address Book
fldFolder.ShowAsOutlookAB = True
End Sub

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For I = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(I))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function

Best regards
Frank


Frankie K. July 25th 06 04:26 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
Hi Sue,

sorry for asking once more but i am not really familiar with VBS.
I used CreateObject as suggested by you but how do i have to adapt your
following code for VBS:

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For I = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(I))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function

Thanks in advance.

Best regards,
Frank

Sue Mosher [MVP-Outlook] schrieb:

The VBScript language doesn't support data-typed variable declarations. Comment out all the ' As clauses and use CreateObject("Outlook.Application") to return an Outlook.Application object.



Sue Mosher [MVP-Outlook] July 25th 06 05:37 PM

activate contact folder from public folder with "show this folder as email address book using a prf file
 
You already did:

Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")

but you still need to get rid of all those As data/object type expressions, which are not supported in VBScript.
--
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

"Frankie K." wrote in message ups.com...
Hi Sue,

sorry for asking once more but i am not really familiar with VBS.
I used CreateObject as suggested by you but how do i have to adapt your
following code for VBS:

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For I = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(I))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function

Thanks in advance.

Best regards,
Frank

Sue Mosher [MVP-Outlook] schrieb:

The VBScript language doesn't support data-typed variable declarations. Comment out all the ' As clauses and use CreateObject("Outlook.Application") to return an Outlook.Application object.




All times are GMT +1. The time now is 11:00 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-2006 OutlookBanter.com