Indicates if specified mailbox exists.
[Syntax] C++: HRESULT IsMailBoxlExisted( BSTR MailBox, long* pVal ) Visual Basic: IsMailBoxExisted( MailBox As String ) As long C#: long IsMailBoxExisted( string MailBox )
Parameters
MailBox
Mailbox name.
Return Value
If specified mail box exists, the return values is zero, otherwise, the return value is non-zero.
Usage Example
[Visual Basic]
Sub CreateMailBox
Dim oStore As ANPOPLib.MSGSTORE
Dim mailBox As String
mailBox = "Inbox"
Set oStore = new ANPOPLib.MSGSTORE
If oStore.IsMailBoxExisted( mailBox ) = 0 Then
MsgBox "mailbox exists"
Exit Sub
End If
If oStore.CreateMailBox( mailBox ) = 0 Then
MsgBox "create mailbox succeeded"
Else
MsgBox "create mailbox failed"
End If
End Sub
[C#]
public void CreateMailBox()
{
MSGSTOREClass oStore = new MSGSTOREClass();
string mailBox = "Inbox";
try
{
if( oStore.IsMailBoxExisted( mailBox ) == 0 )
throw new Exception( "mailbox exists" );
if( oStore.CreateMailBox( mailBox ) != 0 )
throw new Exception( "create mailbox failed" );
Console.WriteLine( "create mailbox succeeded" );
}
catch( Exception e)
{
Console.WriteLine( e.Message );
}
oStore = null;
}
2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.