473,763 Members | 1,320 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 7964

"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
3925
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
1492
by: suedeuno | last post by:
Where can I find docs or help on how to do this?
4
10832
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
2786
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
5627
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
5364
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
3937
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 able to periodically convert my working addressbook file into an alias file I can then transfer...
1
1304
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
1967
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 on one line, and the spaces at the beginning of each line shouldn't be there at all. I have a...
0
9563
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5270
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.