473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Access appointments to Exchange Server problem

Hi All!
I have constructed the Function below to handle sending appointments to Outlook calendars on Local machine or Exchange Server depending on my clients settings.
As you can see olExchFolder is either yes or no and use the routines as noted.
The code I have gleaned from many different sources and cobbled together.

The first part works perfectly sending to local folder. olExchFolder = False
But the second part of the If statement olExchFolder = True raises the error 440 Outlook does not recognize one or more names.

Can anyone see an obvious fault in the code after the 'Else' statement that is stopping it working or am I not addressing the Outlook folder correctly?
Any help would be much appreciated.

Andy.

Expand|Select|Wrap|Line Numbers
  1. Public Function SendAppointmentToOutlook( _
  2.         olExchFolder As Boolean, _
  3.         olCalendarName As String, _
  4.         olStartDate As String, _
  5.         olEndDate As String, _
  6.         olLocation As String, _
  7.         olSubject As String, _
  8.         olBody As String, _
  9.         Optional olDuration As Long = 0, _
  10.         Optional olAllDayEvent As Boolean = True, _
  11.         Optional olReminderMinutes As Long = 90, _
  12.         Optional olReminderSet As Boolean = False)
  13.  
  14.         Dim outobj As Object   ' *The Outlook.Application
  15.         Dim outappt As Object  ' *The Outlook.AppointmentItem
  16.         Dim olFolder As Object ' *The Required Folder/Calendar
  17.         Dim Namespace As Object
  18.         Dim objOutlook As Object
  19.         Dim Recipient As Outlook.Recipient
  20.  
  21. If olExchFolder = False Then ' *Calendars are sub Calendars in My Calendars Folder on Local machine
  22.  
  23.         Set outobj = CreateObject("outlook.application")
  24.         Set olFolder = outobj.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Parent.Folders(olCalendarName)
  25.         'Set olFolder = outobj.GetNamespace("MAPI").pickFolder  ** Calls MAPI Dialog to choose Folder
  26.         Set outappt = olFolder.Items.Add
  27.  
  28. Else    ' *Calendars are in Exchange Folder
  29.  
  30.         Set objOutlook = New Outlook.Application
  31.         Set Namespace = objOutlook.GetNamespace("MAPI")
  32.         Set Recipient = Namespace.CreateRecipient(olCalendarName)
  33.         Set outappt = Namespace.GetSharedDefaultFolder(Recipient, olFolderCalendar).Items.Add
  34. End If
  35.  
  36.         With outappt
  37.             .Start = olStartDate
  38.             .End = olEndDate
  39.             .Duration = olDuration
  40.             .AllDayEvent = olAllDayEvent
  41.             .Location = olLocation
  42.             .Subject = olSubject
  43.             .Body = olBody
  44.             .ReminderMinutesBeforeStart = olReminderMinutes
  45.             .ReminderSet = olReminderSet
  46.             .Save
  47.         End With
  48.  
  49.          ' *Release the Outlook object variables.
  50.          Set outobj = Nothing
  51.          Set outappt = Nothing
  52.          Set olFolder = Nothing
  53.          Set Namespace = Nothing
  54.          Set Recipient = Nothing
  55.          Set objOutlook = Nothing
  56.  
  57. End Function
  58.  
Jul 17 '14 #1
7 2080
twinnyfo
3,653 Expert Mod 2GB
Which line of code is inducing the error? That might help us focus our attention....
Jul 17 '14 #2
twinnyfo
3,653 Expert Mod 2GB
Oddly enough, I just put this code into my VB Editor and it ran without a hitch....

I'm wondering now where the disconnect might be....
Jul 17 '14 #3
twinnyfo
3,653 Expert Mod 2GB
I just tried it again with another user's name.... I think the problem could most have to do with permissions.

I have some code that sends out an appointment, but it doesn't insert it directly into the calendar, but sends it out as you would a normal appointment request. The only problem is that the current user is the one who is the requester, whereas your code puts it out there discreetly.

Are you interested in the alternate option?
Jul 17 '14 #4
Thank you twinnyfo
If I set a break point at the line:
Set outappt = Namespace.GetSharedDefaultFolder(Recipient, olFolderCalendar).Items.Add
and check values of the other parts by hovering.
outobj = "Outlook"
NameSpace = "Mapi"
Recipient = "TestCal" (the name of the shared calendar)
olFolderCalendar = 9
outappt = "Nothing"

I get Error 440 Outlook does not recognize one or more names.
Jul 17 '14 #5
The Calendars are all Fully shared calenders with read/write permissions and currently in use. The first part of the code works great with multiple calendars which are sub folders of parent folder 'My Calendars'
The second part is supposed to work in the same way with shared folders on Exchange Server. But I have this hic-up.
When it works the Administrator will be able to make appointments with customers, log them in Access and send them out to the relevant salespersons calendar.
Thanks for the offer of option 2.
Jul 17 '14 #6
twinnyfo
3,653 Expert Mod 2GB
To be honest, I love you concept and hav ebeen wanting to know how to do it, but I can't in our environment because of security.

Is "TestCal" the full name of the account? Does it have a separate e-mail address? You could try the e-mail address as that worked for me when I used my own account.
Jul 17 '14 #7
Thank you for your interest twinnyfo.
The function as written works perfectly.
The problem was in the form where I inserted the calendar name.
Feel free to use the function in any way you like.
Jul 17 '14 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: M Rao | last post by:
I have xml data coming in as a stream from a web service running against exchange server.The attributes for the elements dtstart and dtend, b:dt="dateTime.tz"...
1
by: Jakob Gram | last post by:
Anybody knows how to access Echange 5.5 Servers public folders from within Access 2000 with rights read/write? regards Jakob Gram
0
by: Diego F. | last post by:
Hi. I need to add appointments in Exchange Server 2003 calendar from a ASP.NET application. I've been searching and in the MSDN there are two articles with samples of doing it with CDOEX and...
1
by: Neil Stansbury | last post by:
Hi all, Apologies if this is not the correct NG. I am trying to find out how to access MS Exchange Server via SOAP. There don't appear to be any specific SOAP interfaces for exchange, is this...
0
by: mbd-team | last post by:
Hello, I'm trying to use Access 2000 from VB-6 as Automation Server. I want to use an Access Form 'withevents'. Code is like: Dim withevents aForm as Access.Form Sub test()
5
by: Eric Smith | last post by:
I'm trying to use Python 2.4.3 and pywin32-209 to access a MySQL database on Windows Server 2003 Standard Edition, and not having much luck. It seems like parts of the MySQLdb module are not...
0
by: Ted Zeng | last post by:
HI, I run a xml_rpc server like the following:(sample code from internet) server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000)) server.serve_forever() If my client is on the...
0
by: arjun | last post by:
hey i am Manju, I want to access the exchange server information like : No of Exchange servers connected to a Domain Controller, Names of the Exchange servers, Their Version Numbers etc...
0
by: kottiPrasad | last post by:
Hello , I have mailboxes in the exchange server and i need to copy the mailboxes data from the exchange server and place it to the other exchange server using c#.Is it possible to access the...
0
by: kottiPrasad | last post by:
Hello , I have mailboxes in the exchange server and i need to copy the mailboxes data from the exchange server and place it to the other exchange server using c#.Is it possible to access the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.