Webmasters, gagnez de l'argent en affichant des bannières contextuelles Oxado
SourceForge.net Logo
Support This Project Free Downloads
WABAccess Project
Welcome ! [ Home ]  ·  [ Downloads ]  ·  [ Forums ]  ·  [ News ]  ·  [ Documentations ]  
[ Home ]

[ Documentations ]

Creating a new Contact or Dl


You can create new Contact or Dl in the Elements collection. The Elements collection provide two methods for this NewContact and NewDl. You can choose to create a new entry in background or leave the user to provide information of the new entry. The two methods return the new object or raise an error. If the user click on Cancel button the method raise the MAPI_E_USER_CANCEL error. If an entry has the same name the MAPI_E_COLLISION error is raised.

Dim objSession, objContact, objDl

OpenWab

Set objContact = CreateNewContact( "John", "SMITH" )

Set objDl = CreateNewDl( "My Society" )

CloseWab

' Create a new contact in the first container
Function CreateNewContact( Firstname, Surname )
    Dim objContainer

    ' get the first container
    Set objContainer = objSession.Containers(1)
    ' create the new contact without asking information to the user
    Set CreateNewContact = objContainer.Elements.NewContact( False, Firstname & " " & Surname )
End Function

' Create a new distribution list in the first container
Function CreateNewDl( Name )
    Dim objContainer

    ' get the first container
    Set objContainer = objSession.Containers(1)
    ' create the new distribution list without asking information to the user
    Set CreateNewDl = objContainer.Elements.NewDl( False, Name )
End Function

WABAccess