Account Storage: Updating an Account

Pre-condition: The storage has to be properly setup and initialized. To setup a storage, please refer to the Initializing storage example.
The code below updates a specific account. The function must have a valid account id for the operation. There is one required parameter:
  • hConnnection represents a client-server connection.
MSG_ERROR_T UpdateAccount(MSG_CONNECTION_HANDLE_T hConnection, MSG_ACCOUNT_ID_T account_id) 
{ 
    MSG_ERROR_T ret; 
    _MSG_ACCOUNT_S account; 
    _MSG_ACCOUNT_S ** ppAccount_original; 

    //connection handle 
    if( hConnection == NULL ) 
        return MSG_ERR_USER_DEFINED; 

    account.accountId= account_id; 

    //get original account information 
    MsgGetAccount(hConnection, account_id, ppAccount_original); 
    //account name 
    account.accountName.encodeType = MSG_ENCODE_ASCII; 
    account.accountName.pString = "UpdateName"; 
    account.accountName.length = 10; 
    //message type 
    account.msgType.mainType = ( * ppAccount_original)->msgType.mainType; 
    account.msgType.subType = ( * ppAccount_original)->msgType.subType; 

    //storage id 
    account.storageId = ( * ppAccount_original)->storageId; 
    account.defaultMsgStorageId = ( * ppAccount_original)->defaultMsgStorageId; 

    //account root folder list 
    account.rootFolderId = ( * ppAccount_original)->rootFolderId; 

    //account extended data 
    _MSG_ACCOUNT_SMS_EXTDATA_S exData; 
    exData.smsServerCenter.pString = "test2.motorola.com"; 
    exData.smsServerCenter.length = 18; 
    exData.portNumber = ; 
    exData.needDeliveryReport = true; 
    exData.autoReply = true; 
    account.pExtData = &exData; 

    //Call mapi method to update account 
    ret = MsgUpdateAccount(hConnection, &account); 

return ret; 
}

Generated on Mon Mar 31 01:01:00 2008 by  doxygen 1.5.4