OpenNTF.org - Send Console Command to Server
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Send Console Command to Server 
Rating:
Not Rated Yet 
Contributor:
Ferhat BULUT 
Category:
C/Cpp 
Type:
Administration 
Document Release:
1.0.0 
Notes Version:
R7.x 
Last Modified:
31 Aug 2006 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
This MFC Project only a sample, you can redistribute all of this project.



void CSendCommandDlg::OnClickSendCommand()
{

LNSetThrowAllErrors(TRUE);

try {

if (! oSession.IsInitialized())
oSession.Init();

HANDLE hRetInfo;
STATUS nError;
char *pBuffer;
// Send Console Command to Server,
// Param 1 : Server Name
// Param 2 : Console Command
// Param 3 : Return String Memory Address

nError = NSFRemoteConsole ("APPDEV01/DEVELOPMENT", "tell amgr run \"UYGULAMALAR\\SalesForceAutomation.nsf\" 'Scheduled Agent 01'", &hRetInfo);

// Check any error
if (nError != NOERROR)
return;

/* Lock the returned buffer handle to obtain a pointer to the
text buffer containing the server command information */

pBuffer = OSLock (char, hRetInfo);

// Take Return message from buffer and show user,

MessageBox(LPCTSTR(pBuffer), "", MB_OK);

// Unlock Buffer
OSUnlock (hRetInfo);

// Free Memory Address
OSMemFree (hRetInfo);

return;

} catch (LNSTATUS error) {

char errorBuf[LNERROR_MESSAGE_LENGTH];

LNGetErrorMessage(error, errorBuf);

MessageBox ( errorBuf, "ERROR", MB_OK );

return;

}

}

Usage / Example
Code Attachments
SendCommand.zip (29 Kbytes)
 Comments
Posted by pierre koerber on 09/19/2006 06:44:07 AMIt exits natively on the notessession object...
SendConsoleCommand method
Sends a console command to a Domino server.
Remarque This method is new with Release 6.
Defined in
NotesSession
 Add your comment!