Remove Method


Remove contact from current object.

long Remove([in] BSTR CID)

Parameters

CID

Unique identifier of contact.

Return Value

Return value is zero if this method succeeds; otherwise return value is non-zero.

Usage Example

Dim server, user, password, requestAddr
server = "localhost"
user = "hunter@emailarchitect.net"
password = "mypassword"
requestAddr = "192.168.0.1"

Dim oSvr
Set oSvr = CreateObject("EmailArchitectObjects.ServerRoot")
r = oSvr.Connect( server, user, password, 0, requestAddr )
If r <> 0 Then
  WScript.Echo( "connect server failed!" )
  WScript.Quit
End If

Dim oDomains, oDomain
Set oDomains = oSvr.DomainCollection
Set oDomain = oDomains.Items(CStr(oSvr.Domain)) 

Dim oUsers, oUser
Set oUsers = oDomain.UserCollection
Set oUser = oUsers.Items(CStr(oSvr.User))

Dim oContacts, oContact
Set oContacts = oUser.ContactCollection
'search contact which has email address "test@emailarchitect.net" and remove it
Dim i, nCount
nCount = oContacts.Count
For i = 0 To nCount-1
  Set oContact = oContacts.Items(CLng(i))
  If LCase(oContact.GetItem("email")) = "test@emailarchitect.net" Then
    Exit For
  End If
  Set oContact = Nothing
Next

If oContact Is Nothing Then
  WScript.Echo "no contact found"
  WScript.Quit
End If

Dim cid
cid = oContact.GetItem("cid")

oContacts.Remove cid
oContacts.Update

EmailArchitect Email Server SDK Document Index

Copyright © 2006 - 2025 AIFEI & AdminSystem Software Limited. All rights reserved.