Hello
First message in this forum!
Im doing some developing in Lotus Notes CAPI and have not been able to get the replication history from Notes.
The funny thing is that I have cut a “code snippet” from the CAPI documentation which in turn does not seem to work?
I have googled and searched for a solution to my problem but have not been able to get any information!
Anyway, the code snippet i found in the CAPI doc:
//==========================================
STATUS error = NOERROR; /* error code from API calls */
HANDLE hReplHist;
REPLHIST_SUMMARY ReplHist;
REPLHIST_SUMMARY *pReplHist;
char szTimedate[MAXALPHATIMEDATE+1];
WORD wLen;
DWORD dwNumEntries, i;
char pServerName; / terminating NULL not included */
char szServerName[MAXUSERNAME + 1];
char pFileName; / includes terminating NULL */
char szDirection[10]; /* NEVER, SEND, RECEIVE */
/* Open the database */
…
/* Get the Replication History Summary */
error = NSFDbGetReplHistorySummary (db_handle, 0, hReplHist, &dwNumEntries);
if (error)
{
NSFDbClose (db_handle);
LAPI_RETURN (ERR(error));
}
/* Obtain a pointer to the first member of the Replication History Summary
array */
pReplHist = OSLock (REPLHIST_SUMMARY, hReplHist);
for (i = 0; i < dwNumEntries; i++)
{
ReplHist = pReplHist[i];
error = ConvertTIMEDATEToText (NULL, NULL, &(ReplHist.ReplicationTime),
szTimedate, MAXALPHATIMEDATE, &wLen);
if (error)
{
OSUnlock (hReplHist);
OSMemFree (hReplHist);
NSFDbClose (db_handle);
LAPI_RETURN (ERR(error));
}
szTimedate[wLen] = ‘\0’;
if (ReplHist.Direction == DIRECTION_NEVER)
strcpy (szDirection, "NEVER");
else if (ReplHist.Direction == DIRECTION_SEND)
strcpy (szDirection, "SEND");
else if (ReplHist.Direction == DIRECTION_RECEIVE)
strcpy (szDirection, "RECEIVE");
else
strcpy (szDirection, "");
pServerName = NSFGetSummaryServerNamePtr (pReplHist, i);
strncpy (szServerName, pServerName, ReplHist.ServerNameLength);
szServerName[ReplHist.ServerNameLength] = ‘\0’;
/* FileName will be NULL terminated */
pFileName = NSFGetSummaryFileNamePtr (pReplHist, i);
printf (“%s %s %s (%s)\n”, szTimedate, szServerName, pFileName, szDirection);
}
OSUnlock (hReplHist);
OSMemFree (hReplHist);
//==========================================
::ConvertTIMEDATEToText
The first iteration in the loop seems to work well, I get a valid date which matches the saved date.
::NSFGetSummaryServerNamePtr
If I look at the pReplHist pointer, it has a servernamelength > 0, which should result in a valid servername.
But, I dont get a servername, pServerName is always empty.
::NSFGetSummaryFileNamePtr
Always returns empty!
In the second iteration, I get an unvalid date and the program exits. If i uncomment the errorhandling and iterates over all
dwNumEntries I never get any data which is not junk.
The only data that is valid is the ReplHist.Direction which seems to work fine!
I found 1 post from a user who had the same problems as me, and he never got a solution.
Does anyone have a solution?
// David