Formatting output - Part 2

T

Tom Petersen

Here is a little more info, sorry should have explained what my final goal
was. I am creating a .vcs file from a form to import into Outlook. I was
just testing the output on screen then pasting that into a file, after
removing the extra white space, and inserting line breaks. The data is
valid, but the formatting into the file isn't working. Was I doing the
formatting right if I was generating a file? I need it to create the .vcs
without any white spaces and a 'return' after each line to match the output
at the very bottom. Here is the code again, and the bit to generate the
file:

strvCalendar = "BEGIN:VCALENDAR" & vbCrLf & _
"VERSION:1.0" & vbCrLf & _
"BEGIN:VEVENT" & vbCrLf & _
"DTSTART:" & strStart & vbCrLf & _
"DTEND:" & strStart & vbCrLf & _
"LOCATION;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrLf & _
"UID:" & strStart & strSubject & vbCrLf & _
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrLf & _
"SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrLf & _
"PRIORITY:3" & vbCrLf & _
"END:VEVENT" & vbCrLf & _
"END:VCALENDAR" & vbCrLf

Response.ContentType = "text/x-vCalendar"
Response.AddHeader "Content-Disposition", _
"filename=Event" & "cal.vcs"
Response.Write strvCalendar
Response.End

This gernerates an error message in Outlook stating it can't import the
calendar file. But, again, if I paste the data into a text file with a .vcs
extension, and delete white space and insert line breaks I can double click
the file and it imports into Outlook fine, this is why I think I just don't
know how to format the 'output' correctly.

I appreciate the help!!!

Final .vcs contents:
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20060208T180000Z
DTEND:20060208T190000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Library
UID:20051022T220000ZI-request
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
PRIORITY:3
END:VEVENT
END:VCALENDAR
 
R

Ray Costanzo [MVP]

Have you tried creating a .vcs file in Outlook and comparing it to what
you're making? Here's what my vcs file looks like that I just created in
Outlook 2002.

BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
DTSTART:20050401T160000Z
DTEND:20050401T170000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Location here
UID:040000008200E00074C5B7101A82E00800000000E017AA4D9F36C5010000000000000000
100
000000D8C46368444C44597269263FBA4BF73
SUMMARY;ENCODING=QUOTED-PRINTABLE:Subject here
PRIORITY:3
END:VEVENT
END:VCALENDAR

Ray at work
 
T

Tom Petersen

Ok, strange, I sent the output to a text file instead of straight to .vcs,
and I get the source code for the page (cal.asp) instead of just the stuff I
want:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>

<STYLE>
A {text-decoration: none;}
</STYLE>
</head>
<body link="#0063CE" vlink="#0063CE" alink="#0063CE">



<div align="center">
<center>
<table border="0" cellpadding="4" cellspacing="0" height="1"
style="border: 2 solid #808080">
<tr>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/index.asp"><font color="#FFFFFF" face="Verdana"
size="1">Home</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/forms.asp"><font color="#FFFFFF" face="Verdana"
size="1">Forms</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/policies.asp"><font color="#FFFFFF" face="Verdana"
size="1">Policies</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/schedule/Page.asp"><font color="#FFFFFF"
face="Verdana" size="1">Schedule</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/staff_directory.asp"><font color="#FFFFFF"
face="Verdana" size="1">Directory</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/publications/publications.asp"><font color="#FFFFFF"
face="Verdana" size="1">Publications</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/support/support.asp"><font color="#FFFFFF"
face="Verdana" size="1">Support</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/workshop/workshop.asp"><font color="#FFFFFF"
face="Verdana" size="1">Workshops</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/forms/adminmenu.asp"><font color="#FFFFFF"
face="Verdana" size="1">Admin</font></a></td>
</tr>
</table>
</center>
</div>

</body>

</html>
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20051122T170000Z
DTEND:20051122T170000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Library
UID:20051122T170000ZI-request
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
PRIORITY:3
END:VEVENT
END:VCALENDAR

So I do get what I need, but whole lot more! :)
Here is the code that is generating this, any ideas on how to fix:

strStart = strYear & strMonth & strDay & "T" & strHour & strMin & strSec &
"Z"


strvCalendar = "BEGIN:VCALENDAR" & vbCrLf & _
"VERSION:1.0" & vbCrLf & _
"BEGIN:VEVENT" & vbCrLf & _
"DTSTART:" & strStart & vbCrLf & _
"DTEND:" & strStart & vbCrLf & _
"LOCATION;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrLf & _
"UID:" & strStart & strSubject & vbCrLf & _
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrLf & _
"SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrLf & _
"PRIORITY:3" & vbCrLf & _
"END:VEVENT" & vbCrLf & _
"END:VCALENDAR" & vbCrLf

'Response.ContentType = "text/x-vCalendar"
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=cal.txt"
'Response.AddHeader "Content-Disposition", _
' "filename=Event" & "cal.txt"
Response.Write strvCalendar
' Response.End

Now, I'm not done generating the calrndar data, but what I have so far is
valid. I'm guessing my problem lies with the last 7 lines of the code...
 
T

Tom Petersen

Quick follow-up.

I am doing a:
'server.execute "../header.htm"
at the beginning of cal.asp, it is puttin gthe contents of that file into my
Response.Write strvCalendar variable.
Is this normal, any way to stop it from doing that? I commented out that
line and it works great!!! (but I still need to do it!)

TIA
 
R

Ray Costanzo [MVP]

Why would you want header HTML in a vcs file? I don't understand.

Ray at home
 
T

Tom Petersen

Figured it out, had Response.End still commented out, seemed to do the
trick.

Thanks for all the help!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top