Coding on the Outlook calendar
Moderator: General Moderators
Coding on the Outlook calendar
On some emails you will notice that your meetings etc are mailed to you as an atttachement on your outlook calendar through which you can see the start time end time etc.
Can we make an email as such that when an email is sent to user we can also send him an attachement file with outlook calendar containing some time information.
Thasnks and Regards,
Atiq
Can we make an email as such that when an email is sent to user we can also send him an attachement file with outlook calendar containing some time information.
Thasnks and Regards,
Atiq
Here is a class I wrote to work with my CRM:
Code: Select all
<?php
/*####################################
#THIS CODE WAS CREATED USING JAMES HAWLEY'S PHP CLASS FORM BUILDER xxx
#November 6, 2004, 6:07 pm
#FILE NAME
#makevcsfile.class.php
#Create a VCS file to be used with outlook
####################################*/
class MakeVCSFileGetOne{
var $id;
var $eventstart; #UNIX TIMESTAMP
var $eventend; #UNIX TIMESTAMP
var $summary;
var $detail;
var $query_len;
var $query_str;
var $location;
function MakeVCSFileGetOne(){
}//END FUNCTION CALL
function generateFile(){
$Filename = "CSCOACT" . $this->getId() . ".vcs";
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=$Filename");
/** Put mysql connection and query statements here **/
$DescDump = str_replace("\r", "=0D=0A=", $this->getDetail());
$vCalStart = date("Ymd\THi00", $this->getEventstart());
$vCalEnd = date("Ymd\THi00", $this->getEventend());
$vSummary = &$this->getSummary();
$vLocation = &$this->getLocation();
$printF = <<<EOT
BEGIN:VCALENDAR
VERSION:1.0
PRODID:
TZ:-07
BEGIN:VEVENT
SUMMARY:$vSummary \n
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:$DescDump \n
DTSTART:$vCalStart \n
DTEND:$vCalEnd \n
LOCATION;ENCODING=QUOTED-PRINTABLE:$vLocation \n
END:VEVENT
END:VCALENDAR
EOT;
echo $printF;
}
function getId(){ return $this->id; }
function getEventstart(){ return $this->eventstart; }
function getEventend(){ return $this->eventend; }
function getSummary(){ return $this->summary; }
function getDetail(){ return $this->detail; }
function getQueryLen(){ return $this->query_len; }
function getQueryStr(){ return $this->query_str; }
function getLocation(){ return $this->location; }
function setId($x){ $this->id=$x; }
function setEventstart($x){ $this->eventstart=$x; }
function setEventend($x){ $this->eventend=$x; }
function setSummary($x){ $this->summary=$x; }
function setDetail($x){ $this->detail=$x; }
function setLocation($x){ $this->location=$x; }
//ASSIGN VAR TO CLASS
/*
$MVCSFGO= new MakeVCSFileGetOne();
$MVCSFGO->setId(123456789);
$MVCSFGO->setEventstart(20041107060708);
$MVCSFGO->setEventend(20041108060708);
$MVCSFGO->setSummary('JAMES TEST MEETING');
$MVCSFGO->setDetail('BODY ');
$MVCSFGO->setLocation('LOCATION ');
$MVCSFGO->generateFile();
*/
}
?>
Last edited by hawleyjr on Sun Jan 22, 2006 9:06 am, edited 2 times in total.
Thanks but if i ran the class with above lines it gives errorhawleyjr wrote:Here is a class I wrote to work with my CRM:
$printF = <<<EOT
BEGIN:VCALENDAR
VERSION:1.0
PRODID:
TZ:-07
BEGIN:VEVENT
SUMMARY:$vSummary \n
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:$DescDump \n
DTSTART:$vCalStart \n
DTEND:$vCalEnd \n
LOCATION;ENCODING=QUOTED-PRINTABLE:$vLocation \n
END:VEVENT
END:VCALENDAR
EOT;
echo $printF;
Parse error: parse error, unexpected T_CLASS in c:\program files\apache group\apache\htdocs\cms\make_csv.php on line 2
if i removed them then there is no error.
Do i need some thing else for above code to work as i don't much about the above code.
Regards,
Atiq
-
Robert Plank
- Forum Contributor
- Posts: 110
- Joined: Sun Dec 26, 2004 9:04 pm
- Contact:
Atiq, what if you tried this code in place of the part that didn't work?
Cool library though, by the way the example lines should be in unix timestamp, as the spec says, not in YYYYmmdd etc. format since that example gets me an appointment for 1995 when it looks like you're trying to do November 2004.
Code: Select all
$printF = "";
$printF .= "BEGIN:VCALENDAR\n";
$printF .= "VERSION:1.0\n";
$printF .= "PRODID:\n";
$printF .= "TZ:-07\n";
$printF .= "BEGIN:VEVENT\n";
$printF .= "SUMMARY:$vSummary \n\n";
$printF .= "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:$DescDump \n\n";
$printF .= "DTSTART:$vCalStart \n\n";
$printF .= "DTEND:$vCalEnd \n\n";
$printF .= "LOCATION;ENCODING=QUOTED-PRINTABLE:$vLocation \n\n";
$printF .= "END:VEVENT\n";
$printF .= "END:VCALENDAR";
echo $printF;-
Robert Plank
- Forum Contributor
- Posts: 110
- Joined: Sun Dec 26, 2004 9:04 pm
- Contact:
Thanks for all the help!
when i am attaching .vcs file and adding some HTML text through the function $MVCSFGO->setDetail('some html message') it is coming in plain text meaning HTML is not taking effect.
If i tried to sent a message like <b>My name is Atiq</b> It is not bolding it instead it is coming with the HTML tags.
Can we sent HTML message in it.
Thanks and Regards,
Atiq
when i am attaching .vcs file and adding some HTML text through the function $MVCSFGO->setDetail('some html message') it is coming in plain text meaning HTML is not taking effect.
If i tried to sent a message like <b>My name is Atiq</b> It is not bolding it instead it is coming with the HTML tags.
Can we sent HTML message in it.
Thanks and Regards,
Atiq
-
Robert Plank
- Forum Contributor
- Posts: 110
- Joined: Sun Dec 26, 2004 9:04 pm
- Contact:
No, you can't have any HTML in it.
If you try creating a new appointment in Outlook, it will let you put in formatting... changing the font, setting bold, etc. But if you save the appointment as a VCS file (which is what this is), and open it back up, the formatting is gone.
So you're stuck with plain-text only.
If you try creating a new appointment in Outlook, it will let you put in formatting... changing the font, setting bold, etc. But if you save the appointment as a VCS file (which is what this is), and open it back up, the formatting is gone.
So you're stuck with plain-text only.
Thanks it is realy helping a lot
From the above code i can set Start Date,End Date,Time,Subject,Location and Body for .vcs file.
but there are some other parameters as well which i need to set.
for example Reminder,Show time as and Label etc.
Can these be set.
Can u give me the list of what can be set through the coding.
Thanks and Regards,
Atiq
From the above code i can set Start Date,End Date,Time,Subject,Location and Body for .vcs file.
but there are some other parameters as well which i need to set.
for example Reminder,Show time as and Label etc.
Can these be set.
Can u give me the list of what can be set through the coding.
Thanks and Regards,
Atiq
-
Robert Plank
- Forum Contributor
- Posts: 110
- Joined: Sun Dec 26, 2004 9:04 pm
- Contact:
Hawley when you "wrote" that code, it was mostly stolen from this URL: http://www.phpbuilder.com/columns/chow2 ... int_mode=1
The only thing about that code I don't get is why the "TZ" field was added in, since it does nothing... the time is interpreted as GMT anyway and changing that doesn't change the time zone at least when importing into Outlook.
Atiq, the vCalendar format doesn't let you specify a reminder or label or anything, that's up to the user when they save the appointment in Outlook. You can specify a category e.g. "Business" but that's about the only extra thing.
The only thing about that code I don't get is why the "TZ" field was added in, since it does nothing... the time is interpreted as GMT anyway and changing that doesn't change the time zone at least when importing into Outlook.
Atiq, the vCalendar format doesn't let you specify a reminder or label or anything, that's up to the user when they save the appointment in Outlook. You can specify a category e.g. "Business" but that's about the only extra thing.