Problems with Outlook.Recipient.Resolve

Status
Not open for further replies.
J

JoD

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
 
Try prefixing each one with "=" to force Outlook to perform an exact match

on the name when it tries to resolve.

Sue Mosher

"JoD" <JoD> wrote in message

news:A2BF1308-D340-4B87-A5C8-447232968165@microsoft.com...
> 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
>
 
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
> > >

> "JoD" <JoD> wrote in message
> news:A2BF1308-D340-4B87-A5C8-447232968165@microsoft.com...
> >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
> >


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

Sue Mosher

"JoD" <JoD> wrote in message

news:32E2203C-7CFA-44C4-AAD7-BC9F35E49F70@microsoft.com...
> 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" <JoD> wrote in message
> > news:A2BF1308-D340-4B87-A5C8-447232968165@microsoft.com...
> > >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
> > >

>

>
>>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
K Outlook for Mac problems Using Outlook 0
V iCloud calendar problems, Outlook shuts down immediately Using Outlook 2
V Outlook 2016 Outlook-2016 and iCloud for Windows - Problems Using Outlook 11
T Many problems with outlook.com - will upgrade to Outlook soon Using Outlook 1
Q Problems with Autodiscover Outlook 2016 Using Outlook 0
D Outlook 2013 Yahoo IMAP Sync problems Using Outlook 1
M Indexing Problems Outlook 365 Using Outlook 2
C 2016 Outlook Certificate Problems Outlook VBA and Custom Forms 3
S Problems syncing emails with webmail after changing to Outlook 2016 Using Outlook 1
O Outlook 2013 Problems sending large mails Using Outlook 4
Diane Poremsky iCloud and Outlook Problems: Syncing Calendar Using Outlook 0
G Outlook problems Using Outlook 2
G Problems with Active Directory Rights Management Services (AD RMS) in Outlook 2013 Exchange Server Administration 0
A Problems Opening Excel from Outlook Outlook VBA and Custom Forms 3
T Outlook Connector calendar sync problems with Android phone Using Outlook.com accounts in Outlook 1
J Outlook 2010 sync problems with Outlook Connector Using Outlook 1
B Outlook being closed causing problems during copy to Excel Outlook VBA and Custom Forms 6
A Problems with Outlook Connector in Outlook 2010 Using Outlook 2
J problems downloading POP3 emails to Outlook 2003 Using Outlook 1
H Problems With Outlook 2013 VBA To Send and Print an email Outlook VBA and Custom Forms 1
L Outlook 2013 setup problems Exchange Server Administration 1
T Outlook 2013 and outlook.com sync problems Using Outlook 5
R Outlook 2013 email folder sync problems using OneDrive Using Outlook 3
M Outlook problems after yesterday's update Using Outlook 4
Jon Bakrley problems with outlook 2013 and pst files Using Outlook 4
C Outlook 2013 compatibility problems with outlook 2007 Using Outlook 3
G Outlook 2013 problems Using Outlook 2
L Weird Inbox problems Outlook 2010/13 and Exchange Exchange Server Administration 2
P outlook.com problems Using Outlook 0
D Outlook and Icloud problems Using Outlook 0
E Outlook 2010 network printing problems Using Outlook 4
P Encoding problems after synchronization with Outlook Connector Using Outlook.com accounts in Outlook 6
J problems with viewing aol emails in Outlook Using Outlook 3
B Problems with outlook calendar and android phone syncing calendars Using Outlook.com accounts in Outlook 1
P Sync Problems Outlook with iPad 2 Using Outlook 3
C migrating from Windows Live Mail over to Outlook 2010 Problems ... Using Outlook 2
J Outlook 2010 and Icloud multiple calenders problems. Using Outlook 10
T Outlook 2007 - iTunes - iCloud Sync Problems Using Outlook 7
S Public FolderEmail Sort Problems Outlook 2010/Migration from 2003 SBS to 2011S Using Outlook 3
S Outlook 2010 and certificate problems Using Outlook 9
M Several Problems using Outlook Using Outlook 3
W Outlook exp. 2007 problems - won't receive new mail Using Outlook 1
P Printing problems with MS Outlook 2000 Using Outlook 1
A Two strange calender problems in Outlook 2003 ... Using Outlook 2
T Outlook 2007 shut down problems Using Outlook 1
A Outlook Advanced Search Problems...returns with an Error: Argument Outlook VBA and Custom Forms 1
T Problems re-installing BCM for Outlook 2007 BCM (Business Contact Manager) 2
D a general question re how backup programs handle pst files ... I have no problems, just curious Using Outlook 1
A iCloud add in problems Using Outlook 4
M Export-Import .pst file problems Using Outlook 2

Similar threads

Back
Top