473,545 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Outlook vcard

Anyone have a link to syntax that could create an outlook vcard file format?
all examples i find are for doing it inside outlook with .net. i'm just
looking for an ASP solution.
Jul 22 '05 #1
3 7919

"scott" <sb*****@milesl umber.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Anyone have a link to syntax that could create an outlook vcard file
format? all examples i find are for doing it inside outlook with .net. i'm
just looking for an ASP solution.


This SQL statement will construct a vcard from a table of contacts.
(Assumes SQL Server is the db engine. You'll need to adjust field names to
match your schema, needless to say.)

---------------------------------------------

DECLARE @crlf char(2)
SET @crlf = CHAR(13) + CHAR(10)

SELECT 'BEGIN:VCARD' + @crlf
+ COALESCE ('N:' + COALESCE (Last, '') + ';'
+ COALESCE (First, '') + ';'
+ COALESCE (Mi, '') + @crlf, '')
+ COALESCE ('FN:' + FullName + @crlf, '')
+ COALESCE ('TITLE:' + Title + @crlf, '')
+ COALESCE ('ORG:' + Company + @crlf, '')
+ COALESCE ('TEL;WORK;VOIC E:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX: ' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOIC E:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX: ' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOIC E:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOI CE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;IN TERNET:' + [email] + @crlf, '')
+ 'REV:' + { fn REPLACE({ fn REPLACE(
{ fn REPLACE(CONVERT (varchar, GETDATE(), 120), '-', '')
}, ':', '') }, ' ', 'T') } + 'Z'+ @crlf
+ 'END:VCARD' + @crlf AS vcard
FROM Contact WHERE ContactID = ? -- expects 1 parameter

---------------------------------------------

This chunk of ASP below will dump a vcard to the browser, using the correct
MIME type. The identity value for the row in the source table is passed-in
to the request as a URL parameter, e.g.,

http://www.mydomain.co m/getvcard.asp?id =123456
Hope it helps,
Mark
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '
<%

Dim ContactID, Sql, rs, ConnStr, cn, cmd
ContactID = Request("id")

Set cmd = Server.CreateOb ject("ADODB.Com mand")
Set cn = Server.CreateOb ject("ADODB.Con nection")

' Build a connection string for your environment
ConnStr = "Provider=SQLOL EDB;Server=(loc al);Database=my database"
cn.Open ConnStr
Set cmd.ActiveConne ction = cn

' Build a VBS string using the SQL above
Sql = "..."

cmd.CommandText = Sql

Dim RecsAffected, CmdParams
CmdParams = Array(CLng(Cont actID))

Set rs = cmd.Execute(Rec sAffected, CmdParams)

If (rs.State = 1) Then
Response.Conten tType = "text/x-vcard"
Response.Write rs.GetString(2, 1, "", "")
rs.close
Else
Response.Write "contact not found"
End If

cn.close
set rs = nothing
set cmd = nothing
set cn = nothing

%>


Jul 22 '05 #2
where does this code send the results to the asp file?
"Mark J. McGinty" <mm******@spamf romyou.com> wrote in message
news:uN******** ******@tk2msftn gp13.phx.gbl...

"scott" <sb*****@milesl umber.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Anyone have a link to syntax that could create an outlook vcard file
format? all examples i find are for doing it inside outlook with .net.
i'm just looking for an ASP solution.


This SQL statement will construct a vcard from a table of contacts.
(Assumes SQL Server is the db engine. You'll need to adjust field names to
match your schema, needless to say.)

---------------------------------------------

DECLARE @crlf char(2)
SET @crlf = CHAR(13) + CHAR(10)

SELECT 'BEGIN:VCARD' + @crlf
+ COALESCE ('N:' + COALESCE (Last, '') + ';'
+ COALESCE (First, '') + ';'
+ COALESCE (Mi, '') + @crlf, '')
+ COALESCE ('FN:' + FullName + @crlf, '')
+ COALESCE ('TITLE:' + Title + @crlf, '')
+ COALESCE ('ORG:' + Company + @crlf, '')
+ COALESCE ('TEL;WORK;VOIC E:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX: ' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOIC E:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX: ' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOIC E:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOI CE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;IN TERNET:' + [email] + @crlf, '')
+ 'REV:' + { fn REPLACE({ fn REPLACE(
{ fn REPLACE(CONVERT (varchar, GETDATE(), 120), '-', '')
}, ':', '') }, ' ', 'T') } + 'Z'+ @crlf
+ 'END:VCARD' + @crlf AS vcard
FROM Contact WHERE ContactID = ? -- expects 1 parameter

---------------------------------------------

This chunk of ASP below will dump a vcard to the browser, using the
correct MIME type. The identity value for the row in the source table is
passed-in to the request as a URL parameter, e.g.,

http://www.mydomain.co m/getvcard.asp?id =123456
Hope it helps,
Mark
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '
<%

Dim ContactID, Sql, rs, ConnStr, cn, cmd
ContactID = Request("id")

Set cmd = Server.CreateOb ject("ADODB.Com mand")
Set cn = Server.CreateOb ject("ADODB.Con nection")

' Build a connection string for your environment
ConnStr = "Provider=SQLOL EDB;Server=(loc al);Database=my database"
cn.Open ConnStr
Set cmd.ActiveConne ction = cn

' Build a VBS string using the SQL above
Sql = "..."

cmd.CommandText = Sql

Dim RecsAffected, CmdParams
CmdParams = Array(CLng(Cont actID))

Set rs = cmd.Execute(Rec sAffected, CmdParams)

If (rs.State = 1) Then
Response.Conten tType = "text/x-vcard"
Response.Write rs.GetString(2, 1, "", "")
rs.close
Else
Response.Write "contact not found"
End If

cn.close
set rs = nothing
set cmd = nothing
set cn = nothing

%>

Jul 22 '05 #3

"scott" <sb*****@milesl umber.com> wrote in message
news:uB******** ******@TK2MSFTN GP12.phx.gbl...
where does this code send the results to the asp file?
It writes a vcard to the client browser context, which detects the MIME type
as sent, and opens it with the appropriately configured/enabled handler
application. (In the case of my workstation, that handler would be Outlook,
which opens it as a contact, but the handler could be Outlook Express, Lotus
Notes, Novell's CRM thing, and presumably many others.)

The effect is analogous to downloading Excel data, and having the browser
open it as a spreadsheet.

-Mark
"Mark J. McGinty" <mm******@spamf romyou.com> wrote in message
news:uN******** ******@tk2msftn gp13.phx.gbl...

"scott" <sb*****@milesl umber.com> wrote in message
news:OM******** ******@TK2MSFTN GP12.phx.gbl...
Anyone have a link to syntax that could create an outlook vcard file
format? all examples i find are for doing it inside outlook with .net.
i'm just looking for an ASP solution.


This SQL statement will construct a vcard from a table of contacts.
(Assumes SQL Server is the db engine. You'll need to adjust field names
to match your schema, needless to say.)

---------------------------------------------

DECLARE @crlf char(2)
SET @crlf = CHAR(13) + CHAR(10)

SELECT 'BEGIN:VCARD' + @crlf
+ COALESCE ('N:' + COALESCE (Last, '') + ';'
+ COALESCE (First, '') + ';'
+ COALESCE (Mi, '') + @crlf, '')
+ COALESCE ('FN:' + FullName + @crlf, '')
+ COALESCE ('TITLE:' + Title + @crlf, '')
+ COALESCE ('ORG:' + Company + @crlf, '')
+ COALESCE ('TEL;WORK;VOIC E:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX: ' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOIC E:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX: ' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOIC E:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOI CE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;IN TERNET:' + [email] + @crlf, '')
+ 'REV:' + { fn REPLACE({ fn REPLACE(
{ fn REPLACE(CONVERT (varchar, GETDATE(), 120), '-', '')
}, ':', '') }, ' ', 'T') } + 'Z'+ @crlf
+ 'END:VCARD' + @crlf AS vcard
FROM Contact WHERE ContactID = ? -- expects 1 parameter

---------------------------------------------

This chunk of ASP below will dump a vcard to the browser, using the
correct MIME type. The identity value for the row in the source table is
passed-in to the request as a URL parameter, e.g.,

http://www.mydomain.co m/getvcard.asp?id =123456
Hope it helps,
Mark
''''''''''''''' ''''''''''''''' ''''''''''''''' ''''''''''''''' '
<%

Dim ContactID, Sql, rs, ConnStr, cn, cmd
ContactID = Request("id")

Set cmd = Server.CreateOb ject("ADODB.Com mand")
Set cn = Server.CreateOb ject("ADODB.Con nection")

' Build a connection string for your environment
ConnStr = "Provider=SQLOL EDB;Server=(loc al);Database=my database"
cn.Open ConnStr
Set cmd.ActiveConne ction = cn

' Build a VBS string using the SQL above
Sql = "..."

cmd.CommandText = Sql

Dim RecsAffected, CmdParams
CmdParams = Array(CLng(Cont actID))

Set rs = cmd.Execute(Rec sAffected, CmdParams)

If (rs.State = 1) Then
Response.Conten tType = "text/x-vcard"
Response.Write rs.GetString(2, 1, "", "")
rs.close
Else
Response.Write "contact not found"
End If

cn.close
set rs = nothing
set cmd = nothing
set cn = nothing

%>


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3909
by: Ed | last post by:
What's the easiest way of developing an address book using ASP that is compatible with vCard? I'd like to be able to do this without 3rd party components. Thanks.
2
1484
by: suedeuno | last post by:
Where can I find docs or help on how to do this?
4
10818
by: Nicholas Then | last post by:
I am writing an ASP.NET application and I have a class that I have written to create a vCard...it just returns a string with all the necessarry info... Anyway...is there a way that I can create a text file in memory and then stream it to the browser so that I do not have to create the file and save it to a temporary location?
1
2770
by: Jason Karns | last post by:
Does anyone know of any stylesheets out that are already built to transform the RDF vCard format (XML) to regular vCard file format (.vcf)? I've searched google for a while now and haven't found anything. -Jason
1
5618
by: MuZZy | last post by:
Hi, I just wonder if anybody knows about any freeware component which can create or read/parse and existing Outlook vCard file. I found a component but it's $600 for site license which is a bit too pricy for me so i wonder if there is anything cheaper (or free ) out there. Any suggestions would be highly appreciated! Thank you,
2
5346
by: Ravi | last post by:
Can someone provide Code for vCARD Parser in C language ? I am in the need for vCard Parser which i can integarte on VC++ environment. Thanks in advance Ravindra Singhai
4
3913
by: R Wood | last post by:
Greetings - A recent Perl experiment hasn't turned out so well, which has piqued my interest in Python. The project is this: take a Vcard file exported from Apple's Addressbook and use a language that is good at parsing text to convert it into a mutt alias file. There are better ways to use Mutt with Mac's addressbook, but I want to be...
1
1292
by: kevlee | last post by:
Hi. I'm pretty new to XSL and I need some help. I know I can create a text output from XSL below... ****************************************** <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" indent="text" /> <xsl:template match="/person"> BEGIN:VCARD
8
1953
by: Dotan Cohen | last post by:
KDE's Kontact PIM breaks quoted-printable vcard files because it linebreaks in the middle of a word. Take this text for example: NOTE;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=D7=A9=D7=95=D7=A8=D7=94 =D7=A 8=D7=90=D7=A9=D7=95=D7=A0=D7=94.\n=D7=94=D7=A9=D7=95=D7=A8=D7=94 =D7=94=D7= A9=D7=A0=D7=99=D7=94 =D7=9B=D7=\n The whole thing should be...
0
7484
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7675
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7928
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5997
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.