Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
custom21 - custom24 setattributebyid for document
shirinp
Hello,
I am trying to set the attributebyId for a document for the date fields custom21, custom22, custom23, custom24. I keep getting an error and I'm not sure what to pass in.
I have the following:
NewDocument1->GetProfile()->SetAttributeByID(imID, OleEntryValue );
I got the additional properties off of a folder, where i had set the date to 06/29/05 and it's return value was "1120017600000". How is it turning that date into this value?
I would truly appreciate any help!
Thanks
Find more posts tagged with
Comments
jny
The .Value (AdditionalProperty) returns a string of UNIX time. You would proably need to convert it to the correct System time.
>>> code begins <<<
// first convert from UNIX time offset to WINDOWS time offset
FILETIME ft;
LONGLONG ll = Int32x32To64(ltime, 10000000) + 116444736000000000;
ft.dwLowDateTime = (DWORD)ll;
ft.dwHighDateTime = (DWORD)(ll >> 32);
// then convert from time offset to a time structure
SYSTEMTIME st;
FileTimeToSystemTime(&ft, &st);
>>> code ends <<<
shirinp
Well, what should i do with that value when I get it? I've tried setting attributebyid with just that value, and i get an error.
So, I tried:
COleDateTime dt;
dt.Format("6/30/2005");
DATE dTimeStamp;
SYSTEMTIME st;
memset(&st, 0, sizeof(SYSTEMTIME));
st.wYear = dt.GetYear();
st.wMonth = dt.GetMonth();
st.wDay = dt.GetDay();
st.wHour = dt.GetHour();
VARIANT vtt;
vtt.vt = VT_DATE;
SystemTimeToVariantTime(&st, &vtt.date );
OleEntryValue = vtt;
NewDocument1->GetProfile()->SetAttributeByID(imID2, OleEntryValue );
The call is successful, however, when I go to view my profile, the date is still not set. How do i enable/check off the checkbox for the date?
Thanks
jny
What happened when you called IManDocument::Update() to commit the changes?
To checkoff the checkbox for the date, set the value to be null.
shirinp
Well, when i call update, it's successfull...
What do you mean by "To checkoff the checkbox for the date, set the value to be null" ? Because, I can only use setattributebyid, and with this, I have to pass in the value of the date.
jny
If you are referring to the checkbox you see on the dialog, it's the SetAttributeValueByID off of the corresponding dialog object that you need to call to remove the check mark from the check box.
If you're referring to something else, please explain in more details.
shirinp
So, you mean that once the date is set by SetAttributeValueById, it automatically unchecks this checkbox?
Well, that's what I would assume too however, the date just doesnt get set for some reason.
jny
The check box value does not associate with the document object attribute itself. The checkbox is a client-side value, which is associated with the field when you see it from the profile dialog.
If you want the date field's associated checkbox to check off, you would need to do this in scripting, namely NewProf.nrs, and get a handle to the dialog object, to use its SetAttributeValueByID method to check off the checkbox.
shirinp
I realized I was using an invalid date~that's why it wasnt getting set correctly.
But now, I have a different problem. I'm trying to set a date property of a folder and since it takes in a Unix timestamp, I am trying to convert a date to this timestamp. Do you know how to convert a FileTime into a unix stamp?
I've tried a couple of things, but the timestamp doesnt seem correct:
long ans = (UINT64)(ft.dwHighDateTime);
ans <<= 32;
ans |= ft.dwLowDateTime;
ans -= 11644473600 * 10000000;
Any tips?
Thanks so much!
shirinp
sorry, i figd it out...
__int64 UnixTime;
UnixTime = ((__int64)ft.dwHighDateTime << 32) |
ft.dwLowDateTime;
UnixTime -= (11644473600 * 10000000);
UnixTime /= 10000000;