C++ API - Date/Time Field Problem

Hi,

I’ve to create a Location Document in a names.nsf Database. In this document, I have to set the field value : Schedule of the Replication tab to 06:00 – 22:00.

I try with the method NSFItemSetTime with a simple TIMEDATE, it works but I don’t know how to set a range value.

Any idea ?

Subject: C++ API - Date/Time Field Problem

Here is a sample code which “reads” Date/Time range. For writing, you could try mimicing the code in reverse direction. I mean properly allocate memory, pack the Notes Item with binary values for your date range. Good luck!

http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/dda3760d2539491185256a95005cf6af?OpenDocument

Regards

Litty Joseph

Subject: RE: C++ API - Date/Time Field Problem

Thanks !

I tried with a TIMEDATE_PAIR into a RANGE object and … it works !

So if someone want a sample source code :

TIMEDATE_PAIR tdPair;



char * tdTextLow = "06:00:00";

TIMEDATE tdLow;

ConvertTextToTIMEDATE(NULL, TTFMT_FULL, &(tdTextLow), (WORD) strlen(tdTextLow), &tdLow);



char * tdTextUp = "22:00:00";

TIMEDATE tdUp;

ConvertTextToTIMEDATE(NULL, TTFMT_FULL, &(tdTextUp), (WORD) strlen(tdTextUp), &tdUp);



tdPair.Lower = tdLow;

tdPair.Upper = tdUp;





WORD usCount;

DWORD dwValueLen;

void far *pvoidItemValue;

RANGE *pRange;

TIMEDATE_PAIR *pTimeDate;

WORD i;



usCount = (WORD) 1;



dwValueLen = sizeof(RANGE) + (usCount * sizeof(TIMEDATE_PAIR));

pvoidItemValue = (void far *) malloc ((size_t)dwValueLen);



pRange = (RANGE*)pvoidItemValue;

pRange->ListEntries = 0;

pRange->RangeEntries = usCount;

pRange++;

pTimeDate = (TIMEDATE_PAIR*)pRange;



*pTimeDate = tdPair;



error = NSFItemAppend (note_handle, ITEM_SUMMARY,

			   "Schedule", strlen("Schedule"),

			   TYPE_TIME_RANGE,

			   pvoidItemValue, dwValueLen);