More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

share code 02-Sep-2010 22:31

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

Code level: intermediate    Code area: Outlook Expert Techniques Printer Friendly Version
Title: Save vCard .vcf file as Outlook contact
Description: This VB/VBA sample uses Windows Scripting Host to open a saved .vcf file. It makes sure no other Outlook item windows are open, then waits for the vCard to open in an Outlook Inspector. You will need to add a reference to the Windows Script Host Object Model to your VB/VBA project or Dim objWSHShell as Object.
Date: 31-Oct-2003  01:03
Code level: intermediate
Code area: Outlook Expert Techniques
Posted by: Sue Mosher
Body:
All 11comments
Page [ 1 2 Next >>  
  24-Nov-2004  16:03   
Sue, I tried using this, but it does not recognize the file name (I created a folder called test and a card called alice.vcf). The code hangs at the line objWSHShell.Run strVCName. I have pasted the code and set the appropriate reference. Should I be running this in VBScript? (I think not.) I also do not have any other items, other than Outlook, open. Any ideas?
  29-Nov-2004  07:52   
Do you get an error? Can you open the .vcf file manually?
  25-Mar-2005  05:48   
Hello Sue Mosher
   Can you tell me how to do the same in .net
Otherwise give me idea how to add the .VCS file in outlook automatically(In Fly) using .net.
  Actually i am taking appointment data from the Database,from the Database i am converting into .VCS file .Again i want to add the .VCS file in Outlook automatically using .net
 If you have any idea just pass to me
  25-Mar-2005  08:06   
Rajkumar, this issue is discussed at http://www.outlookcode.com/threads.aspx?forumid=5&messageid=10769
  28-Mar-2005  01:39   
Hello Sue Mosher
     Yes i had discussed in that page.............the shell program will help to save the VCS file..where the process will call the VCS file ...the client need to save the appointment manually..where us here
If colInsp.Count = 0 Then
        Set objWSHShell = CreateObject("WScript.Shell")
        objWSHShell.Run strVCName
        If Err = 0 Then
            Do Until colInsp.Count = 1
                DoEvents
            Loop
            colInsp.Item(1).CurrentItem.Save
            colInsp.Item(1).Close olDiscard
        End If
    End If
you are saving the VCS file without asking the use to save...where there

System.Diagnostics.Process newProcess = new System.Diagnostics.Process();
newProcess.StartInfo.FileName= strVCName;
newProcess.Start ();

you are starting the process...but nothing is there to save.Please help to work regarding this...
 
  28-Mar-2005  08:51   
Since you already have a discussion going with Helmut, who is well versed in .Net, I suggest that you continue it there. Perhaps you need to cast Inspector.CurrentItem to a ContactItem?
  05-Aug-2005  14:31   
Sue, it seems like the Run method does not accept name with spaces of if directories have spaces. How can I change this ? Is there a flag that I can turn on for such a thing ?
  08-Aug-2005  08:55   
Eric, try enclosing the argument for Run with quotation marks:

    objWSHShell.Run Chr(34) & strVCName & Chr(34)
  13-Feb-2006  11:43   
If I want to work with that contact item object which has just been created, how can I return a handle to it - and assign it to a redemption.safeContactItem?
  17-Feb-2006  15:40   
Dave, as you can see from this statement take from the code above, it's available through its Inspector:

            colInsp.Item(1).CurrentItem.Save

so you'd just use REdemption as usual:

    Set sc = CreateObject("Redemption.SafeContactItem")
    sc.Item = colInsp.Item(1).CurrentItem
Page [ 1 2 Next >>  
Post your comment



name        email