Add Outlook Contact ?? on website
I am asked to put a link on a site so a user can Add Outlook 开发者_如何学运维Contact.
Any examples of this anywhere?
Thanks
Take a look at... http://msdn.microsoft.com/en-us/library/ms268866%28v=vs.80%29.aspx
private void AddContact()
{
Outlook.ContactItem newContact = (Outlook.ContactItem)
this.CreateItem(Outlook.OlItemType.olContactItem);
try
{
newContact.FirstName = "Jo";
newContact.LastName = "Berry";
newContact.Email1Address = "somebody@example.com";
newContact.CustomerID = "123456";
newContact.PrimaryTelephoneNumber = "(425)555-0111";
newContact.MailingAddressStreet = "123 Main St.";
newContact.MailingAddressCity = "Redmond";
newContact.MailingAddressState = "WA";
newContact.Save();
newContact.Display(true);
}
catch
{
MessageBox.Show("The new contact was not saved.");
}
}
For anyone coming along and seeing this - or if somehow Xtian still needs this info - I believe the answer you are looking for is vCard.
Granted, it's not strictly a link/protocol (like mailto:
), but rather a file, it could appear as a link to the user, and when clicked would require a click on "Open" to open the vcf file and a click on "Save" to save the contact to Outlook. It would require that Outlook still has the association with vcf files that it does when it is installed (and that no other program has claimed that association), but it's pretty close to a "link"...
The file generated/provided to the user would have a .vcf
extension and a format similar to the following:
BEGIN:VCARD
VERSION:2.1
N:Doe;John;;;
FN:John Doe
ORG:Doe Company, The;
TITLE: President
NOTE;ENCODING=QUOTED-PRINTABLE: This is a note associated with this
contact=0D=0A
TEL;WORK;VOICE:(987) 123-4567
TEL;HOME;VOICE:(987) 765-4321
TEL;CELL;VOICE:(987) 135-8642
TEL;WORK;FAX:(987) 246-1357
ADR;WORK:;;1234 North Street;Anytown;TX 751234;;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:1234 North Street=0D=0AAnytown, TX
751234 =0D=0AUnited States of America
URL:
URL:<WWLINK TYPE="GENERIC"
VALUE="http://www.doeweb.com">http://www.doeweb.com</WWLINK>
EMAIL;PREF;INTERNET:jdoe@nowhere.com
REV:19980114T170559Z
END:VCARD
精彩评论