13.01.2016, 18:02
Hi,
ich suche jemand der mir bei einem kleinen Outlook Addin helfen kann.
Ich möchte, dass Outlook 2013 bei starten automatisch ein Addin ausführt das folgende Dinge tut:
-Löschen aller Kontakte
-importieren von Windows Kontakten in einem Netzwerk Ordner (CSV oder VCF)
Eigentlich sollte das Plugin ja mit VBA recht einfach zu erstellen sein.
Leider bekomme ich es selbst dennoch nicht hin.
Hier mein Versuch:
ich suche jemand der mir bei einem kleinen Outlook Addin helfen kann.
Ich möchte, dass Outlook 2013 bei starten automatisch ein Addin ausführt das folgende Dinge tut:
-Löschen aller Kontakte
-importieren von Windows Kontakten in einem Netzwerk Ordner (CSV oder VCF)
Eigentlich sollte das Plugin ja mit VBA recht einfach zu erstellen sein.
Leider bekomme ich es selbst dennoch nicht hin.
Hier mein Versuch:
PHP-Code:
Public Class ThisAddIn
Private Sub ThisAddIn_Startup() Handles Me.Startup
End Sub
Sub loesche()
Set objOutlook = CreateObject("Outlook.Application")
Set nms = objOutlook.GetNamespace("MAPI")
Set fldContacts = nms.GetDefaultFolder(olFolderContacts)
Set itms = fldContacts.Items
Do Until itms.Count = 0
itms.Remove 1
Loop
End Sub
Public Sub OpenSharedContact()
Dim oNamespace As NameSpace
Dim oSharedItem As ContactItem
Dim oFolder As Folder
On Error GoTo ErrRoutine
' Get a reference to a NameSpace object.
Set oNamespace = Application.GetNamespace("MAPI")
' Open the vCard (.vcf) file containing the shared item.
Set oSharedItem = oNamespace.OpenSharedItem( _
"LINK.vcf")
' Save the item to the Contacts default folder.
oSharedItem.Save
' Get a reference to and display the Contacts default folder.
Set oFolder = oNamespace.GetDefaultFolder( _
olFolderContacts)
oFolder.Display
EndRoutine:
On Error GoTo 0
Set oSharedItem = Nothing
Set oFolder = Nothing
Set oNamespace = Nothing
Exit Sub
ErrRoutine:
Select Case Err.Number
Case 287 ' &H0000011F
' This error occurs if the code is run by an
' untrusted application, and the user chose not to
' allow access.
MsgBox "Access to Outlook was denied by the user.",
vbOKOnly,
Err.Number & " - " & Err.Source
Case -2147024894 ' &H80070002
' Occurs if the specified file or URL could not
' be found, or the file or URL cannot be
' processed by the OpenSharedItem method.
MsgBox Err.Description,
vbOKOnly,
Err.Number & " - " & Err.Source
Case -2147352567 ' &H80020009
' Occurs if the specified file or URL is not valid,
' or you attempt to use the Move method on
' an Outlook item that represents a shared item.
MsgBox Err.Description,
vbOKOnly,
Err.Number & " - " & Err.Source
Case Else
' Any other error that may occur.
MsgBox Err.Description,
vbOKOnly,
Err.Number & " - " & Err.Source
End Select
GoTo EndRoutine
End Sub
Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
End Sub
End Class
Leider erhalte ich hier bereits 21 Fehler und bekomme diese auch nicht gelöst.
Ich würde mich freuen, wenn sich jemand bereiterklären könnte mir hier zu helfen.
Lg eret12