Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.3: Enable Windows Outlook users to read iCal invitations' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: paulforrester on Jan 14, '04 12:56:40PM
I found that this didn't work well for windows outlook users. From what I can see, outlook doesn't like the TIMEZONE info that iCal puts into the invitation. I modified the script to strip out all timezone info and now it is working well for our company.

on send_mail_sbrp(subjectLine, messageText, myrecipient, invitationPath)
	set pfile to POSIX file invitationPath
	set myfile to pfile as alias
	
	try
		-- define a carriage return
		set cr to (ASCII character 13) & (ASCII character 10)
		
		-- retrieve the user's name and e-mail
		set listOfAccounts to {}
		tell application "Mail"
			repeat with oneAccount in every account
				set listOfAccounts to listOfAccounts & 
					{"\"" & (get full name in oneAccount) & "\" <" & 
						(get email addresses in oneAccount) & ">"}
			end repeat
		end tell
		
		if ((get length of listOfAccounts) is 1) then
			set theAccountTouse to get first item of listOfAccounts
		else
			set theAccountTouse to 
				choose from list listOfAccounts 
					default items (get first item of listOfAccounts) 
					with prompt 
					
						"Please select which mail account to send the invitation from:" without multiple selections allowed and empty selection allowed
		end if
		
		-- open and read the ical event file to insert into an e-mail
		set myEventFileHandle to 
			open for access myfile without write permission
		set myEventFileContent to read myEventFileHandle
		close myEventFileHandle
		
		-- remove the timezone info from the calendar event
		-- to make compatable with outlook
		set toss to false
		set newEventFileContent to ""
		set last_line to false
		repeat with theLine in paragraphs of myEventFileContent
			if theLine contains "BEGIN:VTIMEZONE" then
				set toss to true
			else if theLine contains "END:VTIMEZONE" then
				set last_line to true
				set toss to false
			end if
			if toss is false then
				if last_line is true then
					set last_line to false
				else
					set newEventFileContent to newEventFileContent & theLine & cr
				end if
			end if
		end repeat
		set myEventFileContent to newEventFileContent
		
		-- pre-pend mail headers to the event contents
		set myNewEmailText to 
			"From: " & theAccountTouse & cr & 
			"To: " & myrecipient & cr & 
			"Subject: " & subjectLine & cr & 
			"MIME-Version: 1.0" & cr & 
			"Content-Type: text/calendar;  method=REQUEST;" & cr & 
			"	charset=\"utf-8\"" & cr & 
			"Content-Transfer-Encoding: 8bit" & cr & 
			"Importance: Normal" & cr & cr & 
			myEventFileContent
		--			"  name=\"meeting.ics\"" & cr & 
		
		-- create a random event file name
		set tempMailName to (random number from 1 to 1000000) & ".ics"
		set aliasTempMail to "/tmp/" & tempMailName
		
		-- write the new e-mail to a temp file
		set myEventFileHandle to 
			open for access (POSIX file aliasTempMail as string) with write permission
		write myNewEmailText starting at 1 to myEventFileHandle
		close myEventFileHandle
		
		-- use SENDMAIL to send the file with proper headers
		do shell script "sendmail < " & aliasTempMail
		
		-- delete the temp file
		do shell script "rm " & aliasTempMail
	on error errMsg
		display dialog errMsg
	end try
end send_mail_sbrp


[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: strandbygaard on Jan 19, '04 06:33:37PM

I have a slight modification to paulforrester's solution to the timezone problem with Outlook.

It seems that if every line between BEGIN:VTIMEZONE and END:VTIMEZONE are removed, Outlook will not handle differences in timezones correctly. At least that is the problem I'm having with Outlook 2003 users. I haven't tested this with other versions of Outlook.

For me, the solution to this timezone problem, was to only remove a subset of the VTIMEZONE block, and the code should read BEGIN:STANDARD .... END:STANDARD instead of BEGIN:VTIMEZONE ... END:VTIMEZONE



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: melmaninga on Jan 20, '04 03:22:07PM

In my environment we are using Outlook 2003 as well and the previous versions of the script didn't work. Can you post the script that you are using in it's entirety, as I am an AppleScript newbie and I wasn't quite able to follow the changes highlighted in your post?



[ Reply to This | # ]
10.3: Enable Windows Outlook users to read iCal invitations
Authored by: nestorph on Dec 01, '04 11:34:11AM

Sorry to report that the scripts don't work with 1.5.4. With the first script, the Outlook users calendar comes up with an untitled meeting (in the right time and date), but no option to accept the invitation (options are greyed out). Using the second script, the Outlook user gets an email with no contents.



[ Reply to This | # ]