PC Review


Reply
Thread Tools Rate Thread

Code for the topic :E_ACCESSDENIED error when logging into a CDO session to access Global Address Book{Global Address List}

 
 
deepu
Guest
Posts: n/a
 
      19th Sep 2005
Hi,
Please find the code am trying.
Regards,
deepak

<html>
<head>
<meta name="GENERATOR" content="YesSoftware CodeCharge v.2.0.3 /
Templates.ccp build 10/17/2001">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"><link rel="stylesheet" href="Site.css"
type="text/css">
<link rel="stylesheet" href="Footer.css" type="text/css"></head>
<script src="GlobalAddressBook.vbs" language="VBScript"
type="text/vbscript"></script>
<body class="PageBODY">
<table>
<tr>
<td valign="top">
<!--BeginFormUser-->
<form method="POST" action="{FileName}" name="User">
<table class="FormTABLE">

<!--
<tr>
<td class="FieldCaptionTD"><font
class="FieldCaptionFONT">Login</font></td>
<td class="DataTD"><input type="text" name="login" maxlength="15"
value="{login}" size="15"></td>
</tr>

<tr>
<td class="FieldCaptionTD"><font
class="FieldCaptionFONT">Password</font></td>
<td class="DataTD"><input type="password" name="pass"
maxlength="15" value="{pass}" size="15"></td>
</tr>
-->

<tr>
<td class="FieldCaptionTD"><font
class="FieldCaptionFONT">Name</font></td>
<td class="DataTD"><input type="text" name="user_name"
maxlength="30" value="{user_name}" size="18">
<input type="submit" name="globalAddressBook" value="Browse"
value="Click">
<SCRIPT FOR="globalAddressBook" EVENT="onClick"
LANGUAGE="VBScript">
'For all the API for programming with Outlook
http://msdn.microsoft.com/library/de...ca07c5a4e6.asp
Const cdoE_USER_CANCEL = &H80040113
' start CDO session
Set objSession = CreateObject("MAPI.Session")
Call objSession.Logon ("Outlook")
On Error Resume Next
Set colCDORecips = objSession.AddressBook(, _
"Pick a Name", , , 1, _
"My Choice") 'Returns a Reciepients Collection
Object
If Err = 0 Then
If colCDORecips.Count <> 1 Then
MsgBox "Please choose exactly 1 name.", , _
"Chose One Name"
Else
Set recepObject = colCDORecips.Item(1) 'Returns an object of type
Recepient
isPDL = recepObject.AddressEntry.DisplayType 'Returns the type of
the reciepient address
If isPDL = 1 then 'DisplayType is set to CdoDistList{1} so its a
Public Distribution List
Set objAddrEntriesColl = recepObject.AddressEntry.Members 'Returns
a collection which has all the members
numberOfMembers = objAddrEntriesColl.Count 'Gets the count
For i=1 to numberOfMembers
Set addressEntryObject = objAddrEntriesColl.Item(i) 'Each is a
address entry object
For each objField in addressEntryObject.Fields
If (instr(objField.value,"@domain.com")) Then
Set mailId = objField.value
MsgBox "Correct Mail-id:" &objField.value
End If
Next
Next
ElseIf isPDL = 0 then 'DisplayType is set to CdoUser{0} so its a
Its local messenging user
Set addressEntryObj = colCDORecips.Item(1).AddressEntry
address = addressEntryObj.Address

'MsgBox "The Entry selected is :"
&colCDORecips.Item(1).AddressEntry.Address
For each objField in addressEntryObj.Fields
If (instr(objField.value,"@domain.com")) Then
Set mailId = objField.value
MsgBox "Correct Mail-id:" &objField.value
End If
Next
Else
MsgBox "The selected entry is either not a local user/Public
Distribution List {PDL}. "
End if
If Err = 287 Then
' security block triggered
MsgBox "Outlook cannot return " & _
"a name, because " & _
"you clicked No on the " & _
"e-mail address access " & _
"dialog. You need to try " & _
"again and click Yes " & _
"this time.", , _
"E-mail Address Access"
End If
End If
ElseIf Err = cdoE_USER_CANCEL Then
' user canceled the address book dialog -
' do nothing or provide a message to user
End If
' release objects
objSession.Logoff
Set colCDORecips = Nothing
Set objSession = Nothing
</SCRIPT>
</td>

</tr>
<tr>
<td class="FieldCaptionTD"><font
class="FieldCaptionFONT">Email</font></td>
<td class="DataTD"><input type="text" name="email" maxlength="30"
value="{email}" size="30"></td>
</tr>


<tr>
<td colspan="2" align="right">
<!-- *** Buttons *** -->

<!--BeginUserInsert-->
<input type="hidden" value="insert" name="FormAction">
<input type="submit" value="Add"
onclick="document.User.FormAction.value = 'insert';">
<!--EndUserInsert-->

<!--BeginUserEdit-->
<input type="hidden" value="update" name="FormAction"/>

<!--BeginUserUpdate-->
<input type="submit" value="Update"
onclick="document.User.FormAction.value = 'update';"/>
<!--EndUserUpdate-->

<!--BeginUserDelete-->
<input type="submit" value="Delete"
onclick="document.User.FormAction.value = 'delete';"/>
<!--EndUserDelete-->

<!--EndUserEdit-->

<input type="hidden" name="FormName" value="User"/>

<input type="hidden" name="PK_user_id" value="{PK_user_id}"/>
<input type="hidden" name="user_id" value="{user_id}"/>
</td>
</tr>
</table>
</form>
<!--EndFormUser-->
<SCRIPT Language="JavaScript">
if (document.forms["User"])
document.User.onsubmit=delconf;
function delconf() {
if (document.User.FormAction.value == 'delete')
return confirm('Delete record?');
}
</SCRIPT>
</td>
</tr>
</table>


</body>
</html>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
? posting an item from Address Book [Global Address List] to a specific form and folder luckily Microsoft Outlook Form Programming 3 11th Sep 2006 10:01 PM
Global address list groups missing members in Outlook address book chanhome via OfficeKB.com Microsoft Outlook Contacts 0 19th Nov 2005 04:33 AM
E_ACCESSDENIED error when logging into a CDO session to access Global Address Book{Global Address List} deepu Microsoft Outlook 0 19th Sep 2005 12:50 PM
Global Address List / Outlook Address Book =?Utf-8?B?Y3ljbGVib3kxOTc1KHJlbW92ZSB0aGlzKUBob3Rt Microsoft Outlook Installation 5 24th Dec 2004 04:26 PM
How to copy addresses from Global Address List to local Address book? Richard Microsoft Outlook Contacts 1 12th Aug 2004 07:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:27 AM.