Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Metadata Issue (Date type)

  Asked By: Ezequiel    Date: Mar 15    Category: Sharepoint    Views: 998

I have written a C++ program to check in and out documents into
Sharepoint. I have all the metadata going into sharepoint, but when
you do a search on the data with the date field = to imput date it
does not return the document but if I use >= it works. Someone told
me I need to add the time to the data, I did but it still did not
work. Here is the code that I use for the date field.

CComVariant varCom;
CString szYear = szValue.Right(4);
CString szMonth = szValue.Left(2);
CString szDay = szValue.Mid(3);
szDay = szDay.Left(2);

if (bDebug)
cout << "szYear: ";
cout << (LPCSTR)szYear << endl;
cout << "szMonth: ";
cout << (LPCSTR)szMonth << endl;
cout << "szDay: ";
cout << (LPCSTR)szDay << endl;
DATE date;
SYSTEMTIME sysTime = {0};
sysTime.wDay = atoi(szDay);
sysTime.wMonth = atoi(szMonth);
sysTime.wYear = atoi(szYear);
sysTime.wHour = 00;
sysTime.wMinute = 00;
sysTime.wSecond = 00;
SystemTimeToVariantTime( &sysTime, &date );
varCom.vt = VT_DATE;
varCom.date = date;

Some ideas or code samples would be greatly appreciated.



1 Answer Found

Answer #1    Answered By: Corrine Potts     Answered On: Mar 15

Here is the solution to the problem. After a lot of testing and
playing around with the code  I found out that the code is correct
but the hour must be set to 12 and only 12 otherwise an equal search
will not find it.

> sysTime.wHour = 12; <-- Changed this

Didn't find what you were looking for? Find more on Metadata Issue (Date type) Or get search suggestion and latest updates.