A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problems with Outlook.Recipient.Resolve



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 10th 09, 05:52 PM posted to microsoft.public.outlook.program_vba
JoD
external usenet poster
 
Posts: 4
Default Problems with Outlook.Recipient.Resolve

I am using Microsoft Office 2007 to create Outlook calendar appointments from
Access. I can successfully do this with one exception: I have a series of
calendars with similar names - the last portion of the name, for the 16
calendars, ranges from SEMI-1 to SEMI-16. With the code below, the .Resolve
method is unsuccessful for only the calendar ...SEMI-1.

I have verified that the name correctly matches the name of the calendar.
Any suggestions would be appreciated (including renaming that calendar, if
necessary!)

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objRecipient As Outlook.Recipient
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem
Dim myCalendar, strStart, strShortTime As String

'find and delete the corresponding calendar appointment
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
If Len(Trim(Nz(Me!cboCalendar.Column(0)))) 0 Then ' proceed, should be
an appointment

myCalendar = strCalendar
Set objRecipient = objNameSpace.CreateRecipient(myCalendar)
' check calendar name
objRecipient.Resolve
If objRecipient.Resolved Then
' create start date/time
strStart = strExamDate & " " & strStartTime
strStart = Format(strExamDate & " " & strStartTime, "mm/dd/yyyy
hh:mm AMPM")

' set values for objects and delete appointment
Set objFolder =
objNameSpace.GetSharedDefaultFolder(objRecipient, olFolderCalendar)
Set objItems = objFolder.Items
Set objAppt = objItems.Find("[Start] = """ & strStart & """")
If objAppt Is Nothing Then
MsgBox ("This appointment was not found in Outlook")
Else
objAppt.Delete
Set objAppt = Nothing
'Now display appropriate message
MsgBox ("Appointment deleted from Outlook")
End If

Set objItems = Nothing
Set objFolder = Nothing
Else
MsgBox ("No appointment deleted, could not resolve calendar name")
End If
Else
MsgBox ("No appointment deleted, no existing appointment")
End If

'Release the object variables
Set objNameSpace = Nothing
Set objRecipient = Nothing
Set objOutlook = Nothing

Ads
  #2  
Old September 10th 09, 06:02 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Problems with Outlook.Recipient.Resolve

Try prefixing each one with "=" to force Outlook to perform an exact match
on the name when it tries to resolve.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JoD" wrote in message
...
I am using Microsoft Office 2007 to create Outlook calendar appointments
from
Access. I can successfully do this with one exception: I have a series of
calendars with similar names - the last portion of the name, for the 16
calendars, ranges from SEMI-1 to SEMI-16. With the code below, the
.Resolve
method is unsuccessful for only the calendar ...SEMI-1.

I have verified that the name correctly matches the name of the calendar.
Any suggestions would be appreciated (including renaming that calendar, if
necessary!)

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objRecipient As Outlook.Recipient
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem
Dim myCalendar, strStart, strShortTime As String

'find and delete the corresponding calendar appointment
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
If Len(Trim(Nz(Me!cboCalendar.Column(0)))) 0 Then ' proceed, should
be
an appointment

myCalendar = strCalendar
Set objRecipient = objNameSpace.CreateRecipient(myCalendar)
' check calendar name
objRecipient.Resolve
If objRecipient.Resolved Then
' create start date/time
strStart = strExamDate & " " & strStartTime
strStart = Format(strExamDate & " " & strStartTime, "mm/dd/yyyy
hh:mm AMPM")

' set values for objects and delete appointment
Set objFolder =
objNameSpace.GetSharedDefaultFolder(objRecipient, olFolderCalendar)
Set objItems = objFolder.Items
Set objAppt = objItems.Find("[Start] = """ & strStart & """")
If objAppt Is Nothing Then
MsgBox ("This appointment was not found in Outlook")
Else
objAppt.Delete
Set objAppt = Nothing
'Now display appropriate message
MsgBox ("Appointment deleted from Outlook")
End If

Set objItems = Nothing
Set objFolder = Nothing
Else
MsgBox ("No appointment deleted, could not resolve calendar
name")
End If
Else
MsgBox ("No appointment deleted, no existing appointment")
End If

'Release the object variables
Set objNameSpace = Nothing
Set objRecipient = Nothing
Set objOutlook = Nothing



  #3  
Old September 10th 09, 06:38 PM posted to microsoft.public.outlook.program_vba
JoD
external usenet poster
 
Posts: 4
Default Problems with Outlook.Recipient.Resolve

Could you kindly show me an example of what you mean? I'm not sure where the
"=" would go.

Thanks!

"Sue Mosher [MVP]" wrote:

Try prefixing each one with "=" to force Outlook to perform an exact match
on the name when it tries to resolve.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JoD" wrote in message
...
I am using Microsoft Office 2007 to create Outlook calendar appointments
from
Access. I can successfully do this with one exception: I have a series of
calendars with similar names - the last portion of the name, for the 16
calendars, ranges from SEMI-1 to SEMI-16. With the code below, the
.Resolve
method is unsuccessful for only the calendar ...SEMI-1.

I have verified that the name correctly matches the name of the calendar.
Any suggestions would be appreciated (including renaming that calendar, if
necessary!)

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objRecipient As Outlook.Recipient
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem
Dim myCalendar, strStart, strShortTime As String

'find and delete the corresponding calendar appointment
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
If Len(Trim(Nz(Me!cboCalendar.Column(0)))) 0 Then ' proceed, should
be
an appointment

myCalendar = strCalendar
Set objRecipient = objNameSpace.CreateRecipient(myCalendar)
' check calendar name
objRecipient.Resolve
If objRecipient.Resolved Then
' create start date/time
strStart = strExamDate & " " & strStartTime
strStart = Format(strExamDate & " " & strStartTime, "mm/dd/yyyy
hh:mm AMPM")

' set values for objects and delete appointment
Set objFolder =
objNameSpace.GetSharedDefaultFolder(objRecipient, olFolderCalendar)
Set objItems = objFolder.Items
Set objAppt = objItems.Find("[Start] = """ & strStart & """")
If objAppt Is Nothing Then
MsgBox ("This appointment was not found in Outlook")
Else
objAppt.Delete
Set objAppt = Nothing
'Now display appropriate message
MsgBox ("Appointment deleted from Outlook")
End If

Set objItems = Nothing
Set objFolder = Nothing
Else
MsgBox ("No appointment deleted, could not resolve calendar
name")
End If
Else
MsgBox ("No appointment deleted, no existing appointment")
End If

'Release the object variables
Set objNameSpace = Nothing
Set objRecipient = Nothing
Set objOutlook = Nothing




  #4  
Old September 10th 09, 07:04 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_3_]
external usenet poster
 
Posts: 465
Default Problems with Outlook.Recipient.Resolve

Set objRecipient = objNameSpace.CreateRecipient("=" & myCalendar)

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"JoD" wrote in message
...
Could you kindly show me an example of what you mean? I'm not sure where
the
"=" would go.

Thanks!

"Sue Mosher [MVP]" wrote:

Try prefixing each one with "=" to force Outlook to perform an exact
match
on the name when it tries to resolve.

"JoD" wrote in message
...
I am using Microsoft Office 2007 to create Outlook calendar appointments
from
Access. I can successfully do this with one exception: I have a series
of
calendars with similar names - the last portion of the name, for the 16
calendars, ranges from SEMI-1 to SEMI-16. With the code below, the
.Resolve
method is unsuccessful for only the calendar ...SEMI-1.

I have verified that the name correctly matches the name of the
calendar.
Any suggestions would be appreciated (including renaming that calendar,
if
necessary!)

Dim objOutlook As Outlook.Application
Dim objNameSpace As Outlook.NameSpace
Dim objRecipient As Outlook.Recipient
Dim objFolder As Outlook.MAPIFolder
Dim objItems As Outlook.Items
Dim objAppt As Outlook.AppointmentItem
Dim myCalendar, strStart, strShortTime As String

'find and delete the corresponding calendar appointment
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
If Len(Trim(Nz(Me!cboCalendar.Column(0)))) 0 Then ' proceed,
should
be
an appointment

myCalendar = strCalendar
Set objRecipient = objNameSpace.CreateRecipient(myCalendar)
' check calendar name
objRecipient.Resolve
If objRecipient.Resolved Then
' create start date/time
strStart = strExamDate & " " & strStartTime
strStart = Format(strExamDate & " " & strStartTime,
"mm/dd/yyyy
hh:mm AMPM")

' set values for objects and delete appointment
Set objFolder =
objNameSpace.GetSharedDefaultFolder(objRecipient, olFolderCalendar)
Set objItems = objFolder.Items
Set objAppt = objItems.Find("[Start] = """ & strStart &
"""")
If objAppt Is Nothing Then
MsgBox ("This appointment was not found in Outlook")
Else
objAppt.Delete
Set objAppt = Nothing
'Now display appropriate message
MsgBox ("Appointment deleted from Outlook")
End If

Set objItems = Nothing
Set objFolder = Nothing
Else
MsgBox ("No appointment deleted, could not resolve calendar
name")
End If
Else
MsgBox ("No appointment deleted, no existing appointment")
End If

'Release the object variables
Set objNameSpace = Nothing
Set objRecipient = Nothing
Set objOutlook = Nothing






  #5  
Old November 9th 12, 07:34 PM
Raguram Raguram is offline
Junior Member
 
First recorded activity at Outlookbanter: Nov 2012
Posts: 1
Default

Just replace the argument for the CreateRecipient Method with a fully qualified email address (of the recipient)

Set objRecipient = objNameSpace.CreateRecipient ("abc @ company.com")

I had faced a similar issue and this did the trick for me !



Raguram

Last edited by Raguram : November 9th 12 at 07:37 PM. Reason: code snippet not displayed properly
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Wont Resolve Addresses - help! Davy Outlook - General Queries 8 May 17th 08 10:24 PM
turn off resolve recipient James Outlook - Using Contacts 1 May 22nd 07 10:28 PM
Problems with Autocomplete/resolve Outlook 2003 [email protected] Outlook - General Queries 0 July 27th 06 09:04 PM
Problems with Recipient.Add and Macro Signing ??? asousa Outlook - Using Forms 3 June 19th 06 04:14 PM
Maintain form when recipient forwards to another recipient Holly Utzinger Outlook - Using Forms 3 May 5th 06 12:40 AM


All times are GMT +1. The time now is 05:14 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-2025 Outlook Banter.
The comments are property of their posters.