ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 1st, 2003, 10:51 AM
mparter mparter is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 1 mparter User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Copy an appointment to a public folder

I'm using a workaround for the limitations of CDO not
being able to create or copy appointment items to anywhere
other than the default calendar. The workaround basically
involves using GetFolder to retrieve the default calendar
and then copy the message to the required location. Here's
the code:

Code:
strMailbox = "whoever"
strProfileInfo = strServer & vbLf & strMailbox
Set objSession = Server.CreateObject("MAPI.Session")
objSession.Logon , , False, True, 0, True, strProfileInfo

'get the public folder
Set objPublicFolder = getPublicFolder()
'get the calendar for the specified room
Set objBookingsFolder = findSubFolders
(objPublicFolder, "Bookings")
Set objRoomsFolder = findSubFolders
(objBookingsFolder, "Rooms")

Set objCalendar = objSession.GetDefaultFolder
(CdoDefaultFolderCalendar)
strCalendarID = objCalendar.ID
Set objRoom = objSession.GetFolder(strRoom, strStoreID)

'add the appointment to the default calendar
Set objBooking = objCalendar.Messages.Add
With objBooking
	.Type = "IPM.Appointment"
	.Importance = 1
	.TimeReceived = Now
	.Subject = Request.Form("subject")
	.Location = objRoom.Name
	.Text = Request.Form("text")
	.BusyStatus = 2 'set this to busy
	.StartTime = strStartTime
	.EndTime = strEndTime

	.Update
End With

Set objCalendar = objSession.GetFolder(strCalendarID, 
NULL) 'get the folder to copy the booking from
Set objBooking = objCalendar.Messages.GetLast() 'get the 
last message created

Set objCopyBooking = objBooking.CopyTo(objRoom.ID) 'get 
the booking to copy
objCopyBooking.Update 'save it


The problem with this is if I use the GetLast() method, a
few lines up, it will return the last message in the
default calendar which isn't necessarily the last message
created. I've tried using the GetMessage method, i.e.

Code:
Set objBooking = objSession.GetMessage(objBooking.ID, 
objBooking.StoreID)


but this doesn't work, presumably because it's returning
the message as an appointment item and not a message and
the CopyTo method doesn't support appointment items. Are
there any better ways of creating appointments in public
folders, etc or any workarounds for the above problem?

Thanks in advance,

Mark

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Copy an appointment to a public folder


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT