GAL program acces in outlook 2007

Status
Not open for further replies.
G

Guille

Hi, i got the following problem:

When i try to acces to the GAL using the CDO component an error pops up:

ACCESS DENIED when i try to see the GAL contact dates.

When i use the Outlook 2003 it works withot a problem, but in the 2007

Outlook it gets me that error even when im using the same font

This is the font code. In this part "For Each objAddress In

objGAL.AddressEntries

" its when i get the problem in Outlook 2007.

Ill apreciate if u can give me an answer the soon as posible.

Guille

Const strServer = "MyServer"

Const strMailbox = "MyMailbox"

Dim objSession As New MAPI.Session

Dim objAdds As MAPI.AddressLists

Dim objAddress As MAPI.AddressEntry

Dim objGAL As MAPI.AddressList

Dim objFields As MAPI.Fields, objField As MAPI.Field

Dim Codigo_User As String

Dim strAddress As String

Dim cnxRRHH As New ADODB.Connection

Dim cnxRRHHCS As New ADODB.Connection

Dim cmdRRHH As New ADODB.Command

Dim cmdRRHHCS As New ADODB.Command

Dim rsRRHH As New ADODB.Recordset

Dim strLista As String

Dim strProfileInfo As String

cnxRRHH.Open glStrConexionRRHH

cnxRRHHCS.Open glStrConexionRRHHCS

cmdRRHH.ActiveConnection = cnxRRHH

cmdRRHHCS.ActiveConnection = cnxRRHHCS

rsRRHH.CursorType = adOpenStatic

rsRRHH.CursorLocation = adUseClient

strProfileInfo = strServer & vbLf & strMailbox

objSession.Logon , , False, False, , True, strProfileInfo

If objSession Is Nothing Then Exit Sub

lstContacto.Clear

strEntidadSolicita = ""

Set objAdds = objSession.AddressLists

Set objGAL = objAdds.Item("Lista global de direcciones")

pbarCarga.Min = 0

pbarCarga.Max = objGAL.AddressEntries.Count

pbarCarga.Value = 0

Me.Repaint

For Each objAddress In objGAL.AddressEntries

pbarCarga.Value = pbarCarga.Value + 1

Me.frmCarga.Repaint

If objAddress.DisplayType = CdoUser Or objAddress.DisplayType =

CdoRemoteUser Then

If InStr(1, Trim(objAddress.Name), " ", vbTextCompare) > 0 Then

'Identifica Entidad Solicitante

If Trim(Me.txtSolicita.Text) = Trim(objAddress.Name) Then

Set objFields = objAddress.Fields

strAddress = objFields.Item(972947486)

strEntidadSolicita = IIf(InStr(1, strAddress,

"scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress, "crediscotia.com.pe"),

"CSF", ""))

End If

If InStr(1, Me.txtBody.Text, objAddress.Name, vbTextCompare)
> 0 Then


Set objFields = objAddress.Fields

Codigo_User = objFields.Item(973078558) '973078558:

codigo nickname

If Val(Mid(Codigo_User, 2)) > 0 Then

strAddress = objFields.Item(972947486)

cmdRRHH.CommandText = "Select

Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _

"From dbo.V_Trabajador_General

Where cast(Codigo as numeric(10,0))=" & Val(Mid(Codigo_User, 2))

Set rsRRHH = cmdRRHH.Execute

If rsRRHH.BOF = False Or rsRRHH.EOF = False Then

strLista = objAddress.Name & " - " &

CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &

LCase(Trim(rsRRHH("des_pto")))

Else

cmdRRHHCS.CommandText = "Select

Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _

"From

dbo.V_Trabajador_General Where cast(Codigo as numeric(10,0))=" &

Val(Mid(Codigo_User, 2))

'If rsRRHH.State = 1 Then

' rsRRHH.Close

'End If

Set rsRRHH = cmdRRHHCS.Execute

If rsRRHH.BOF = False Or rsRRHH.EOF = False Then

strLista = objAddress.Name & " - " &

CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &

LCase(Trim(rsRRHH("des_pto")))

Else

strLista = objAddress.Name & " - " &

"000:OTROS - OTROS"

End If

End If

lstContacto.AddItem strLista & ":" & IIf(InStr(1,

strAddress, "scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress,

"crediscotia.com.pe"), "CSF", "OTRO"))

lstContacto.SetFocus

End If

End If

End If

End If

Next
 
D

Dmitry Streblechenko

Are you logged as as the same user and accessing the same mailbox in both

cases?

Are oyu using a cached profile in both cases?

Dmitry Streblechenko (MVP)

-

"Guille" <Guille> wrote in message

news:F1CDFF7A-8C79-4899-8EFC-39AF6F500BF7@microsoft.com...
> Hi, i got the following problem:

> When i try to acces to the GAL using the CDO component an error pops up:
> ACCESS DENIED when i try to see the GAL contact dates.

> When i use the Outlook 2003 it works withot a problem, but in the 2007
> Outlook it gets me that error even when im using the same font

> This is the font code. In this part "For Each objAddress In
> objGAL.AddressEntries
> " its when i get the problem in Outlook 2007.
> Ill apreciate if u can give me an answer the soon as posible.

> Guille

> Const strServer = "MyServer"
> Const strMailbox = "MyMailbox"

> Dim objSession As New MAPI.Session
> Dim objAdds As MAPI.AddressLists
> Dim objAddress As MAPI.AddressEntry
> Dim objGAL As MAPI.AddressList
> Dim objFields As MAPI.Fields, objField As MAPI.Field
> Dim Codigo_User As String
> Dim strAddress As String
> Dim cnxRRHH As New ADODB.Connection
> Dim cnxRRHHCS As New ADODB.Connection
> Dim cmdRRHH As New ADODB.Command
> Dim cmdRRHHCS As New ADODB.Command
> Dim rsRRHH As New ADODB.Recordset
> Dim strLista As String
> Dim strProfileInfo As String

> cnxRRHH.Open glStrConexionRRHH
> cnxRRHHCS.Open glStrConexionRRHHCS

> cmdRRHH.ActiveConnection = cnxRRHH
> cmdRRHHCS.ActiveConnection = cnxRRHHCS

> rsRRHH.CursorType = adOpenStatic
> rsRRHH.CursorLocation = adUseClient

> strProfileInfo = strServer & vbLf & strMailbox

> objSession.Logon , , False, False, , True, strProfileInfo

> If objSession Is Nothing Then Exit Sub

> lstContacto.Clear
> strEntidadSolicita = ""

> Set objAdds = objSession.AddressLists
> Set objGAL = objAdds.Item("Lista global de direcciones")
> pbarCarga.Min = 0
> pbarCarga.Max = objGAL.AddressEntries.Count
> pbarCarga.Value = 0
> Me.Repaint
> For Each objAddress In objGAL.AddressEntries
> pbarCarga.Value = pbarCarga.Value + 1
> Me.frmCarga.Repaint
> If objAddress.DisplayType = CdoUser Or objAddress.DisplayType =
> CdoRemoteUser Then
> If InStr(1, Trim(objAddress.Name), " ", vbTextCompare) > 0 Then
> 'Identifica Entidad Solicitante
> If Trim(Me.txtSolicita.Text) = Trim(objAddress.Name) Then
> Set objFields = objAddress.Fields
> strAddress = objFields.Item(972947486)
> strEntidadSolicita = IIf(InStr(1, strAddress,
> "scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress,
> "crediscotia.com.pe"),
> "CSF", ""))
> End If
> If InStr(1, Me.txtBody.Text, objAddress.Name,
> vbTextCompare)
> > 0 Then

> Set objFields = objAddress.Fields
> Codigo_User = objFields.Item(973078558) '973078558:
> codigo nickname
> If Val(Mid(Codigo_User, 2)) > 0 Then
> strAddress = objFields.Item(972947486)
> cmdRRHH.CommandText = "Select
> Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _
> "From dbo.V_Trabajador_General
> Where cast(Codigo as numeric(10,0))=" & Val(Mid(Codigo_User, 2))
> Set rsRRHH = cmdRRHH.Execute
> If rsRRHH.BOF = False Or rsRRHH.EOF = False Then
> strLista = objAddress.Name & " - " &
> CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &
> LCase(Trim(rsRRHH("des_pto")))
> Else
> cmdRRHHCS.CommandText = "Select
> Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _
> "From
> dbo.V_Trabajador_General Where cast(Codigo as numeric(10,0))=" &
> Val(Mid(Codigo_User, 2))
> 'If rsRRHH.State = 1 Then
> ' rsRRHH.Close
> 'End If
> Set rsRRHH = cmdRRHHCS.Execute
> If rsRRHH.BOF = False Or rsRRHH.EOF = False
> Then
> strLista = objAddress.Name & " - " &
> CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &
> LCase(Trim(rsRRHH("des_pto")))
> Else
> strLista = objAddress.Name & " - " &
> "000:OTROS - OTROS"
> End If
> End If

> lstContacto.AddItem strLista & ":" & IIf(InStr(1,
> strAddress, "scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress,
> "crediscotia.com.pe"), "CSF", "OTRO"))
> lstContacto.SetFocus
> End If
> End If
> End If
> End If
> Next
>
 
G

Guille

About your questin, yes im using the same user in both cases.

When i try to access GAL the program logs with the RED user, but, with any

other ser it conects normaly in Outlook 2003 and when i try to ejecute the

same macro in Outlook 2007 it keeps getting me the error.

"Dmitry Streblechenko" wrote:


> Are you logged as as the same user and accessing the same mailbox in both
> cases?
> Are oyu using a cached profile in both cases?

> > Dmitry Streblechenko (MVP)
>

>

>

> -
> "Guille" <Guille> wrote in message
> news:F1CDFF7A-8C79-4899-8EFC-39AF6F500BF7@microsoft.com...
> > Hi, i got the following problem:
> > When i try to acces to the GAL using the CDO component an error pops up:
> > ACCESS DENIED when i try to see the GAL contact dates.
> > When i use the Outlook 2003 it works withot a problem, but in the 2007
> > Outlook it gets me that error even when im using the same font
> > This is the font code. In this part "For Each objAddress In
> > objGAL.AddressEntries
> > " its when i get the problem in Outlook 2007.
> > Ill apreciate if u can give me an answer the soon as posible.
> > Guille
> > Const strServer = "MyServer"
> > Const strMailbox = "MyMailbox"
> > Dim objSession As New MAPI.Session
> > Dim objAdds As MAPI.AddressLists
> > Dim objAddress As MAPI.AddressEntry
> > Dim objGAL As MAPI.AddressList
> > Dim objFields As MAPI.Fields, objField As MAPI.Field
> > Dim Codigo_User As String
> > Dim strAddress As String
> > Dim cnxRRHH As New ADODB.Connection
> > Dim cnxRRHHCS As New ADODB.Connection
> > Dim cmdRRHH As New ADODB.Command
> > Dim cmdRRHHCS As New ADODB.Command
> > Dim rsRRHH As New ADODB.Recordset
> > Dim strLista As String
> > Dim strProfileInfo As String
> > cnxRRHH.Open glStrConexionRRHH
> > cnxRRHHCS.Open glStrConexionRRHHCS
> > cmdRRHH.ActiveConnection = cnxRRHH
> > cmdRRHHCS.ActiveConnection = cnxRRHHCS
> > rsRRHH.CursorType = adOpenStatic
> > rsRRHH.CursorLocation = adUseClient
> > strProfileInfo = strServer & vbLf & strMailbox
> > objSession.Logon , , False, False, , True, strProfileInfo
> > If objSession Is Nothing Then Exit Sub
> > lstContacto.Clear
> > strEntidadSolicita = ""
> > Set objAdds = objSession.AddressLists
> > Set objGAL = objAdds.Item("Lista global de direcciones")
> > pbarCarga.Min = 0
> > pbarCarga.Max = objGAL.AddressEntries.Count
> > pbarCarga.Value = 0
> > Me.Repaint
> > For Each objAddress In objGAL.AddressEntries
> > pbarCarga.Value = pbarCarga.Value + 1
> > Me.frmCarga.Repaint
> > If objAddress.DisplayType = CdoUser Or objAddress.DisplayType =
> > CdoRemoteUser Then
> > If InStr(1, Trim(objAddress.Name), " ", vbTextCompare) > 0 Then
> > 'Identifica Entidad Solicitante
> > If Trim(Me.txtSolicita.Text) = Trim(objAddress.Name) Then
> > Set objFields = objAddress.Fields
> > strAddress = objFields.Item(972947486)
> > strEntidadSolicita = IIf(InStr(1, strAddress,
> > "scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress,
> > "crediscotia.com.pe"),
> > "CSF", ""))
> > End If
> > If InStr(1, Me.txtBody.Text, objAddress.Name,
> > vbTextCompare)
> >> 0 Then

> > Set objFields = objAddress.Fields
> > Codigo_User = objFields.Item(973078558) '973078558:
> > codigo nickname
> > If Val(Mid(Codigo_User, 2)) > 0 Then
> > strAddress = objFields.Item(972947486)
> > cmdRRHH.CommandText = "Select
> > Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _
> > "From dbo.V_Trabajador_General
> > Where cast(Codigo as numeric(10,0))=" & Val(Mid(Codigo_User, 2))
> > Set rsRRHH = cmdRRHH.Execute
> > If rsRRHH.BOF = False Or rsRRHH.EOF = False Then
> > strLista = objAddress.Name & " - " &
> > CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &
> > LCase(Trim(rsRRHH("des_pto")))
> > Else
> > cmdRRHHCS.CommandText = "Select
> > Codigo,Ape_Pat,Ape_Mat,Nombre,Cod_Cdr,Cdr,puesto,des_pto " & _
> > "From
> > dbo.V_Trabajador_General Where cast(Codigo as numeric(10,0))=" &
> > Val(Mid(Codigo_User, 2))
> > 'If rsRRHH.State = 1 Then
> > ' rsRRHH.Close
> > 'End If
> > Set rsRRHH = cmdRRHHCS.Execute
> > If rsRRHH.BOF = False Or rsRRHH.EOF = False
> > Then
> > strLista = objAddress.Name & " - " &
> > CStr(Val(rsRRHH("Cod_Cdr"))) & ":" & LCase(Trim(rsRRHH("Cdr"))) & " - " &
> > LCase(Trim(rsRRHH("des_pto")))
> > Else
> > strLista = objAddress.Name & " - " &
> > "000:OTROS - OTROS"
> > End If
> > End If
> > lstContacto.AddItem strLista & ":" & IIf(InStr(1,
> > strAddress, "scotiabank.com.pe"), "SBP", IIf(InStr(1, strAddress,
> > "crediscotia.com.pe"), "CSF", "OTRO"))
> > lstContacto.SetFocus
> > End If
> > End If
> > End If
> > End If
> > Next
> >


> .
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Outlook mail adressing stops after first match in GAL Using Outlook 0
E GAL Attributes to Contacts Using Outlook 0
E Customer wants a portion of GAL from exchange to sync down to Android contacts via Activesync Using Outlook 2
M Retrieve data from GAL and put it in Clipboard Using Outlook 1
marcadamcarter Interrogate Outlook GAL with PowerShell Using Outlook 0
J Blank GAL in OAB Exchange Server Administration 1
S Searching contacts across GAL and local address book at same time Using Outlook 1
S Newly added user doesn't show up in GAL but available in OWA, Using Outlook 0
S Script to parse email subject, get Username, look up in GAL and redirect email Exchange Server Administration 6
S Pushing GAL to a public folder Exchange Server Administration 2
P Email Header/People pane/contact card - GAL photo vs. contact photo Using Outlook 7
A Managing GAL via OWA Exchange Server Administration 5
A How to disable bcc option in GAL - Address Book - Exchange 2007 Exchange Server Administration 4
O VSTO - Outlook Add-In - Get GAL data Outlook VBA and Custom Forms 1
C Problem while converting GAL entries to contacts in Outlook Cont Outlook VBA and Custom Forms 5
Q GAL.ResolveName issue with REDEMPTION Outlook VBA and Custom Forms 5
J Program Checkbox that will activate a text box in a Outlook fallible form. Outlook VBA and Custom Forms 1
T Outlook "A program is trying to access Outlook" Using Outlook 3
Andrew Quirl Open attachment, manipulate without add-on program? Outlook VBA and Custom Forms 5
R SearchPublicFolders program Outlook VBA and Custom Forms 1
Diane Poremsky To Change the Default E-mail Program in Windows New Slipstick.com Articles 0
I There is no email program associated to perform requested action Using Outlook 0
Diane Poremsky Trial/Beta program for BCM replacement BCM (Business Contact Manager) 8
J it goes like outlook has stopped working, a problem caused the program to stop working correctly, wi Using Outlook 2
J My Outlook program has stopped receiving. I can still send Using Outlook 1
C New version of MFCMAPI program Using Outlook 0
K A program is trying to send an e-mail message on your behalf... Using Outlook 1
A outlook 2007 - there is no email program associated ... Using Outlook 3
F Default Program for Opening .pst Files ? Using Outlook 6
A Outlook-Program Not Closing Properly Using Outlook 10
B How to remove an old program from the Tools dropdown? Using Outlook 7
D How to set permissions to allow external program to send an email? Using Outlook 0
T getting an error This file does not have a program associated with it for performing this action. C Using Outlook 7
N The add-in "C:\program files\google\google desktop search\googledesktopO..." could not be installed Using Outlook 32
R Access Program Only Looping Part Way Through Outlook Inbox Outlook VBA and Custom Forms 2
M Allow or Deny when a Program tries to send an email Outlook VBA and Custom Forms 1
R how to (re)set the default data file for Outlook in a VB program Outlook VBA and Custom Forms 2
J Program won't end in Win7 Outlook VBA and Custom Forms 1
D Outlook 2003 - A program is trying to access e-mail addresses Outlook VBA and Custom Forms 5
D Running a Program from Custom Action Rule Outlook VBA and Custom Forms 1
S Email Organizer Program Outlook VBA and Custom Forms 2
H Program "Click on Ribbon Button" Using VBA Outlook VBA and Custom Forms 1
H Program email save as text file Outlook VBA and Custom Forms 5
M Run external program from Outlook VBA macro Outlook VBA and Custom Forms 5
N How to attach a file with MS Outlook, from a program? Outlook VBA and Custom Forms 3
Q why this program doesn't work if Outlook is not manually launched? Outlook VBA and Custom Forms 4
V how to switchoff program access message in outlook 2003 Outlook VBA and Custom Forms 1
V "A program has attachment filename open" Message returns Outlook VBA and Custom Forms 4
J Program Compatibility Issue - Outlook 2003 BCM BCM (Business Contact Manager) 4
L Sending data from Outllok to Acces Outlook VBA and Custom Forms 1

Similar threads

Top