| 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 >> ] | ||
|
|
Josetta
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? |
|
|
|
Sue Mosher
29-Nov-2004 07:52
Do you get an error? Can you open the .vcf file manually? |
|
|
|
rajkumar
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 |
|
|
|
Sue Mosher
25-Mar-2005 08:06
Rajkumar, this issue is discussed at http://www.outlookcode.com/threads.aspx?forumid=5&messageid=10769 |
|
|
|
rajkumar
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... |
|
|
|
Sue Mosher
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? |
|
|
|
Eric
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 ? |
|
|
|
Sue Mosher
08-Aug-2005 08:55
Eric, try enclosing the argument for Run with quotation marks: objWSHShell.Run Chr(34) & strVCName & Chr(34) |
|
|
|
Dave
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? |
|
|
|
Sue Mosher
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 |
