ClulessChris
IS-IT--Management
I have a routine that will:
a. Look to users Personal Address Book (PAB)
b. Check for specific address (A Public folder) and if this is not found add the address.
c. launch a custom eform from that folder.
the issue is that to send to a Public folder the folders address must be in the users PAB, and Outlook must resolve the addresses from the PAB rarther than any other Address book (e.g. GAL, Contacts).
Is there a way I can:
1. Set names to be checked from PAB first
2. (this ones not so important but would be nice) Create a PAB if one is not found.
Many thanks for your help in advance.
O Yea here's the code I use:
a. Look to users Personal Address Book (PAB)
b. Check for specific address (A Public folder) and if this is not found add the address.
c. launch a custom eform from that folder.
the issue is that to send to a Public folder the folders address must be in the users PAB, and Outlook must resolve the addresses from the PAB rarther than any other Address book (e.g. GAL, Contacts).
Is there a way I can:
1. Set names to be checked from PAB first
2. (this ones not so important but would be nice) Create a PAB if one is not found.
Many thanks for your help in advance.
O Yea here's the code I use:
Code:
Public Sub ImportRequests()
'---------------------------------------------------------------------------------------
' Procedure : ImportRequests
' DateTime : 22/Oct/2003 17:11
' Author : Chris Hellings; 6021134
' Purpose :
'---------------------------------------------------------------------------------------
'
Dim olApp As Outlook.Application
Dim olNSPace As NameSpace
Dim olAddList As Outlook.AddressList
Dim olAddEntries As Outlook.AddressEntries
Dim olAddEntry As Outlook.AddressEntry
Dim bItIsThere As Boolean
Dim olPubFolder As Outlook.MAPIFolder
Dim olForm As Outlook.MailItem
On Error GoTo ImportRequests_Error
Screen.MousePointer = vbHourglass
Set olApp = New Outlook.Application
Set olNSPace = olApp.GetNamespace("MAPI")
Set olAddList = olNSPace.AddressLists("Personal Address Book")
Set olAddEntries = olAddList.AddressEntries
Set olAddEntry = olAddEntries.GetFirst
Set olPubFolder = olNSPace.Folders("Public Folders").Folders("Clerical Support")
Do Until olAddEntry Is Nothing
If olAddEntry.Name = "Clerical Support" Then
' It's there
bItIsThere = True
Exit Do
End If
Set olAddEntry = olAddEntries.GetNext
Loop
If Not bItIsThere Then
' address not found
Set olAddEntry = olAddEntries.Add("EX", "Clerical Support" _
, "/o=Inland Revenue/ou=IR01/cn=Recipients/cn=CLERICAL SUPPORT9FBEA2D39FBEA2D39FBEA2D383F644246BFEF9")
olAddEntry.Update
End If
Set olForm = olPubFolder.Items.Add("IPM.Note.Form Request")
olForm.To = "Clerical Support"
olForm.CC = ""
olForm.BCC = ""
olForm.Display
ImportRequests_Exit:
Set olAddList = Nothing
Set olAddEntries = Nothing
Set olAddEntry = Nothing
Set olApp = Nothing
Set olNSPace = Nothing
Screen.MousePointer = vbDefault
On Error GoTo 0
Exit Sub
NoPAB:
MsgBox "The application couldn't find your Personal Address Book." & vbCrLf & _
"Please ensure you have a Personal Address Book set up" & vbCrLf & _
"and try again.", vbCritical, "Object not found"
GoTo ImportRequests_Exit
ImportRequests_Error:
If Err.Number = -2147221233 Then
GoTo NoPAB
End If
MsgBox Err.Number & ", " & Err.Description
GoTo ImportRequests_Exit
End Sub
[\code]
Everybody body is somebodys Nutter.