MAPI

V

Vadivu

Hi,
I want to use MAPI to retrieve the details from Global Address Book .
When I give MAPI.Session, it gave me an Error:"Active-x Component can't
create the object".
I tried to know MAPI32.dll was registered Properly.In command Prompt I gave
regsvr32 MAPI32.dll after giving the path details from C:\.
It said "MAPI32.dll was loaded.But the DllRegisterServer Entry point was
not Found.This file cannot be registered" .
I tried again after installing new MicrosoftOffice setup.
But even after that also, I got that same Message.
So, Whenever I try to use MAPI.Session in my Program,It is telling "Active-x
component can't create the object".
Could you please tell me the solution for this?

Regards,
Vadivu
 
S

Sue Mosher [MVP-Outlook]

MAPI.Session is not MAPI32.DLL. It's cdo.dll. CDO is an optional component for installations of Outlook 2003 and earlier and must be downloaded and installed if you want to use it in Outlook 2007.
 
V

Vadivu

Hello Sue,
Yes.I got it.I can get the details from GAL now using this.Thank you.
I have another Question regarding GAL update.
This is my Program:
Const CdoPR_GIVEN_NAME = &H3A06001E
Const CdoPR_ENTRYID = &HFFF0102
Const CdoPR_DISPLAY_NAME =&H3001001E
Const CdoPR_TITLE = &H3A17001E
Const CdoPR_COMPANY_NAME =&H3A16001E
Const CdoPR_DEPARTMENT_NAME =&H3A18001E
Const CdoPR_OFFICE_LOCATION =&H3A19001E
Const CdoPR_BUSINESS_TELEPHONE_NUMBER =&H3A08001E
Const CdoPR_MOBILE_TELEPHONE_NUMBER = &H3A1C001E
Const CdoPR_STREET_ADDRESS =&H3A29001E
Const CdoPR_LOCALITY = &H3A27001E
Const CdoPR_POSTAL_CODE =&H3A2A001E
Const CdoPR_BUSINESS2_TELEPHONE_NUMBER =&H3A1B001E
Const CdoPR_PRIMARY_FAX_NUMBER =&H3A23001E
Const CdoPR_EMAIL=&H39FE001E
Const strServer = "MyServer"
Const strMailbox = "MyMailbox"
Dim strProfileInfo
strProfileInfo = strServer & vbLf & strMailbox

Set session = CreateObject("MAPI.Session")
Session.Logon , , False, False, , True, strProfileInfo
MsgBox(session.currentuser & " " &"Logged In")
'set AddrList = Session.AddressBook.AddressLists.Item("Global Address
List")
set AddrList = Session.AddressLists.Item("Global Address List")
MsgBox "There are " & AddrList.AddressEntries.Count & " items in the GAL"

Set objAddressEntries = AddrList.AddressEntries
int i=0

For Each objAddressEntry In objAddressEntries

on error resume next
Set objAddressFields = objAddressEntry.Fields

If Not objAddressFields is Nothing Then

WriteLog ("Name : " & " " & objAddressEntry.Name & "||" & " " & "Manager
:" & " " & objAddressEntry.Manager &"||" & " "&"JobTitle :" & " " &
objAddressEntry.Fields(CdoPR_TITLE) &"||" &" " & "Company :" & " " &
objAddressEntry.Fields(CdoPR_COMPANY_NAME) &"||" & " " &"Department :" & " "
& objAddressEntry.Fields(CdoPR_DEPARTMENT_NAME)&"||" & " " & "Office :" & " "
& objAddressEntry.Fields(CdoPR_OFFICE_LOCATION)&"||" & " "&"Phone :" & " " &
objAddressEntry.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER)&"||" & " " & "Address
:" & " " & objAddressEntry.Fields(CdoPR_STREET_ADDRESS)&"||" & " "&"City :" &
" " & objAddressEntry.Fields(CdoPR_LOCALITY) &"||" & " "&"ZipCode :" & " " &
objAddressEntry.Fields(CdoPR_POSTAL_CODE)&"||" & " "&"Fax :" & " " &
objAddressEntry.Fields(CdoPR_PRIMARY_FAX_NUMBER) &"||" & " " &"E-Mail :" & "
" & objAddressEntry.Fields(CdoPR_EMAIL))
'WriteLog ("Name : " & " " & objAddressEntry.Name & "||" & " " & "Manager
:" & " " & objAddressEntry.Manager &"||" & " "&"JobTitle :" & " " &
objAddressEntry.Fields(CdoPR_TITLE) &"||" &" " & "Company :" & " " &
objAddressEntry.Fields(CdoPR_COMPANY_NAME) &"||" & " " &"Department :" & " "
& objAddressEntry.Fields(CdoPR_DEPARTMENT_NAME) &"||" & " " & "Office :" & "
" & objAddressEntry.Fields(CdoPR_OFFICE_LOCATION) &"||" & " "&"Phone :" & " "
& objAddressEntry.Fields(CdoPR_BUSINESS_TELEPHONE_NUMBER) &"||" & " "
&"Mobile :" & " " & objAddressEntry.Fields(CdoPR_MOBILE_TELEPHONE_NUMBER)
&"||" & " " & "Address :" & " " &
objAddressEntry.Fields(CdoPR_STREET_ADDRESS) &"||" & " "&"City :" & " " &
objAddressEntry.Fields(CdoPR_LOCALITY) &"||" & " "&"ZipCode :" & " " &
objAddressEntry.Fields(CdoPR_POSTAL_CODE) &"||" & " " &"Business Phone :" & "
" & objAddressEntry.Fields(CdoPR_BUSINESS2_TELEPHONE_NUMBER) &"||" & " "&"Fax
:" & " " & objAddressEntry.Fields(CdoPR_PRIMARY_FAX_NUMBER) &"||" & " "
&"E-Mail :" & " " & objAddressEntry.Fields(CdoPR_EMAIL))

if(objAddressEntry.Name ="Vadivukarasi Kumaresan") Then
MsgBox("Found :" & objAddressEntry.Name)
objAddressEntry.Name = "Vadivu"
objAddressEntry.Save
MsgBox("Changed Name: " & objAddressEntry.Name)
end if
End If
Next

I used My credentials for Servername and Mailbox which I have not shown
here.My name is included in Admin Group who have all rights to change
GAL.Here I tried to Change my name from "Vadivukarasi Kumaresan"
to"Vadivu".While running this Script, I can see the change of Name.But it is
not reflecting in Address Book.Could you please help me?

Regards,
Vadivu
 
V

Vadivu

Hi,
Thanks for your Guidance so far.
I tried to connect to ADSI, using this Command, using vb.net
I added refereces "Active DS" and LDAPAUTH lib.

Dim AddressListCont = GetObject("LDAP://Myserver/CN=All Global Address
Lists,CN=Address Lists Container,CN=MyOrg,CN=Microsoft
Exchange,CN=Services,CN=Configuration,DC=MyDomain,DC=com")

But it shows me the Error:" Cannot create Active X Component"

Which dll should I add to this Program?
Can you please give some sample program to work with Global Address List?
I'll be thankful to you if I can successfully update GAL .

REgards,
Vadivu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top