Create Outlook vcard

S

scott

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.
 
M

Mark J. McGinty

scott said:
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;VOICE:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX:' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOICE:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX:' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOICE:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOICE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;INTERNET:' + (e-mail address removed)
 
S

scott

where does this code send the results to the asp file?


Mark J. McGinty said:
scott said:
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;VOICE:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX:' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOICE:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX:' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOICE:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOICE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;INTERNET:' + (e-mail address removed)
 
M

Mark J. McGinty

scott said:
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 said:
scott said:
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;VOICE:' + PhoneWork + @crlf, '')
+ COALESCE ('TEL;WORK;FAX:' + FaxWork + @crlf, '')
+ COALESCE ('TEL;HOME;VOICE:' + [PhoneHome] + @crlf, '')
+ COALESCE ('TEL;HOME;FAX:' + [FaxHome] + @crlf, '')
+ COALESCE ('TEL;CELL;VOICE:' + [PhoneMobile] + @crlf, '')
+ COALESCE ('TEL;PAGER;VOICE:' + [Pager] + @crlf, '')
+ 'ADR;WORK:;;' + COALESCE ([Address], '') + ';'
+ COALESCE ([City], '') + ';' + COALESCE ([State], '') + ';'
+ COALESCE ([Zip], '') + @crlf
+ COALESCE ('EMAIL;PREF;INTERNET:' + (e-mail address removed)
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top