Forums
This topic is locked
Create a vCard from a db?
Posted 20 Jul 2005 09:23:10
1
has voted
20 Jul 2005 09:23:10 Henrik Sandeberg posted:
Hello,I have a phonebook with names, numbers and emails, and so on, its in Access, I want to have a link like create_vcard.asp?id=20 or something like that, but how do i create the vcard script, anyone who has done this before?
Replies
Replied 22 Jul 2005 09:49:38
22 Jul 2005 09:49:38 Henrik Sandeberg replied:
So, after a while, i solved it, here is my solution, i have a db with surname, firstname and so on (access),
Any questions about it? I dont have the date of birth in the file.....
<pre id=code><font face=courier size=2 id=code><%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Portal.asp" -->
<%
Dim Rstest__MMColParam
Rstest__MMColParam = "1"
If (Request.QueryString("user_id" <> "" Then
Rstest__MMColParam = Request.QueryString("user_id"
End If
%>
<%
Dim Rstest
Dim Rstest_numRows
Set Rstest = Server.CreateObject("ADODB.Recordset"
Rstest.ActiveConnection = MM_Portal_STRING
Rstest.Source = "SELECT * FROM list WHERE user_id = " + Replace(Rstest__MMColParam, "'", "''" + ""
Rstest.CursorType = 0
Rstest.CursorLocation = 2
Rstest.LockType = 1
Rstest.Open()
Rstest_numRows = 0
%>
<%
firstname = Rstest("firstname"
surname = Rstest("surname"
Address = Rstest("address"
Zip = Rstest("zip"
City = Rstest("city"
Country = Rstest("country"
Phone = Rstest("phone"
mobile = Rstest("mobile"
email = Rstest("email"
note = Rstest("note"
'dob = Rstest("dob"
sex = Rstest("sex"
response.AddHeader "content-disposition", "attachment; filename="& firstname &" "& surname &".vcf"
Response.write "BEGIN:VCARD"& vbcrlf
response.write "VERSION:2.1"& vbcrlf
Response.write "N:"& surname &";"& firstname & vbcrlf
response.write "FN:"& firstname &" "& surname & vbcrlf
response.write "NOTE:"& note & vbcrlf
response.write "TEL;HOME;VOICE:"& phone & vbcrlf
response.write "TEL;CELL;VOICE:"& mobile & vbcrlf
response.write "ADR;HOME:;;"& address &";"& city &";;"& zip &";"& country & vbcrlf
response.write "LABEL;HOME;ENCODING=QUOTED-PRINTABLE:"& address &"=0D=0A"& city & " "& zip &"=0D=0A"& Country & vbcrlf
response.write "X-WAB-GENDER:"
if sex = "male" then
response.write "2"& vbcrlf
else
response.write "1"& vbcrlf
end if
response.write "BDAY:"& year(date())& Right(0 & month(dob),2)&Right(0 & day(dob),2)& vbcrlf
response.write "EMAIL;PREF;INTERNET:"& email & vbcrlf
response.write "REV:"& year(date())& right(0& month(date()),2)& right(0& day(date()),2)&"T0"& right(0&second(now()),2)&right(0&minute(now()),2)&left(0&second(now()),1)&"Z"& vbcrlf
response.write "END:VCARD"
%>
<%
Rstest.Close()
Set Rstest = Nothing
%> </font id=code></pre id=code>
Any questions about it? I dont have the date of birth in the file.....
<pre id=code><font face=courier size=2 id=code><%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Portal.asp" -->
<%
Dim Rstest__MMColParam
Rstest__MMColParam = "1"
If (Request.QueryString("user_id" <> "" Then
Rstest__MMColParam = Request.QueryString("user_id"
End If
%>
<%
Dim Rstest
Dim Rstest_numRows
Set Rstest = Server.CreateObject("ADODB.Recordset"
Rstest.ActiveConnection = MM_Portal_STRING
Rstest.Source = "SELECT * FROM list WHERE user_id = " + Replace(Rstest__MMColParam, "'", "''" + ""
Rstest.CursorType = 0
Rstest.CursorLocation = 2
Rstest.LockType = 1
Rstest.Open()
Rstest_numRows = 0
%>
<%
firstname = Rstest("firstname"
surname = Rstest("surname"
Address = Rstest("address"
Zip = Rstest("zip"
City = Rstest("city"
Country = Rstest("country"
Phone = Rstest("phone"
mobile = Rstest("mobile"
email = Rstest("email"
note = Rstest("note"
'dob = Rstest("dob"
sex = Rstest("sex"
response.AddHeader "content-disposition", "attachment; filename="& firstname &" "& surname &".vcf"
Response.write "BEGIN:VCARD"& vbcrlf
response.write "VERSION:2.1"& vbcrlf
Response.write "N:"& surname &";"& firstname & vbcrlf
response.write "FN:"& firstname &" "& surname & vbcrlf
response.write "NOTE:"& note & vbcrlf
response.write "TEL;HOME;VOICE:"& phone & vbcrlf
response.write "TEL;CELL;VOICE:"& mobile & vbcrlf
response.write "ADR;HOME:;;"& address &";"& city &";;"& zip &";"& country & vbcrlf
response.write "LABEL;HOME;ENCODING=QUOTED-PRINTABLE:"& address &"=0D=0A"& city & " "& zip &"=0D=0A"& Country & vbcrlf
response.write "X-WAB-GENDER:"
if sex = "male" then
response.write "2"& vbcrlf
else
response.write "1"& vbcrlf
end if
response.write "BDAY:"& year(date())& Right(0 & month(dob),2)&Right(0 & day(dob),2)& vbcrlf
response.write "EMAIL;PREF;INTERNET:"& email & vbcrlf
response.write "REV:"& year(date())& right(0& month(date()),2)& right(0& day(date()),2)&"T0"& right(0&second(now()),2)&right(0&minute(now()),2)&left(0&second(now()),1)&"Z"& vbcrlf
response.write "END:VCARD"
%>
<%
Rstest.Close()
Set Rstest = Nothing
%> </font id=code></pre id=code>
Replied 26 Jul 2008 01:12:51
26 Jul 2008 01:12:51 Mark Neill replied:
So how do I make the results invoke the outlook client to see the in contact?