| Author |
Message |
Rachel Devons
Guest
|
Posted:
Thu Jan 13, 2005 12:36 am Post subject:
Setting metadata date fields in SPS 2003 |
|
|
I've been able to set custom fields (metadata) on documents in SPS 2003 by
doing the following:
file.Item["<field name>"]="<field value>";
file.Item.Update();
Where file is a SPFile object that contains the document.
However, I have a field that is a date field and when I try to set this
field, I receive the error "Specified cast is invalid."
From what I understood, the metadata in SPS 2003 is all strings, so I'm not
sure why I am getting this error. The document library was imported from SPS
2001 using SPIN/SPOUT so perhaps that might have something to do with it.
Can anyone shed any light on this? Do I need to cast the field value to
something? Any help would be greatly appreciated! |
|
| Back to top |
|
 |
Hollis D. Paul
Guest
|
Posted:
Thu Jan 13, 2005 12:36 am Post subject:
Re: Setting metadata date fields in SPS 2003 |
|
|
In article <#37dd9O#EHA.3820@TK2MSFTNGP11.phx.gbl>, Rachel Devons wrote:
| Quote: | Thanks for the post. I hadn't thought of that, but unfortunately, I am still
getting the same error. I tried various ways of formatting the date, but
still the problem persists.
Any other ideas?
Did you catch this post that showed up today? |
*********************
Search on Numeric property on Sharepoint 2003
From: "rdcpro" <rdcpro@hotmail.com>
Newsgroups: microsoft.public.sharepoint.portalserver
Subject: Search on Numeric property on Sharepoint 2003
Date: 12 Jan 2005 13:27:47 -0800
I finally got resolution on the custom metadata and HTMLProp.dll issue.
In case the previous posts aren't available anymore, the issue is that
htmlprop.dll, found in the Windows Platform SDK, is supposed to convert
a variety of DateTime meta tags (with certain formats) to a DateTime
datatype, so that functions such as DATEADD() can be used in an SPS
query. You can't use CAST in a where clause (a limitation of the
MSSQLFT language), and by default all custom metadata is returned as
String.
A similar situation exists with integer types as well. The problem is,
no matter what I did, the custom metadata was always coming back as a
string. I followed all the instructions posted in the platform SDK,
plus a bunch that PSS provided, to no avail.
While this isn't documented anywhere, it turns out that this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPSSearch\ContentIndexCommon\Filters\CLS
ID\{25336920-03F9-11CF-8FD0-00AA00686F13}
contained the GUID of nlhtml.dll, not HTMLProp.dll.
The GUID {25336920-03F9-11CF-8FD0-00AA00686F13} is used to identify
file and MIME types for HTML, GIF, JPEG, plain text and similar files.
It's sort of like an extension. I had placed the GUID of htmlprop.dll
in all the right places but this one, as it wasn't specified.
*********************
Hollis D. Paul [MVP - Outlook]
Hollis@outhousebythesound.com
Mukilteo, WA USA |
|
| Back to top |
|
 |
Marco
Guest
|
Posted:
Thu Jan 13, 2005 2:47 am Post subject:
RE: Setting metadata date fields in SPS 2003 |
|
|
Do you have the date field in the correct format. For SPS this should be
YYYY-MM-DDTHH:MMZ e.g 2005-01-12T20:42Z
Marco
"Rachel Devons" wrote:
| Quote: | I've been able to set custom fields (metadata) on documents in SPS 2003 by
doing the following:
file.Item["<field name>"]="<field value>";
file.Item.Update();
Where file is a SPFile object that contains the document.
However, I have a field that is a date field and when I try to set this
field, I receive the error "Specified cast is invalid."
From what I understood, the metadata in SPS 2003 is all strings, so I'm not
sure why I am getting this error. The document library was imported from SPS
2001 using SPIN/SPOUT so perhaps that might have something to do with it.
Can anyone shed any light on this? Do I need to cast the field value to
something? Any help would be greatly appreciated!
|
|
|
| Back to top |
|
 |
Rachel Devons
Guest
|
Posted:
Thu Jan 13, 2005 3:40 am Post subject:
Re: Setting metadata date fields in SPS 2003 |
|
|
Thanks for the post. I hadn't thought of that, but unfortunately, I am still
getting the same error. I tried various ways of formatting the date, but
still the problem persists.
Any other ideas?
"Marco" <Marco@discussions.microsoft.com> wrote in message
news:3C6DF32D-A5B2-46D6-B4A8-F0857EDF2743@microsoft.com...
| Quote: | Do you have the date field in the correct format. For SPS this should be
YYYY-MM-DDTHH:MMZ e.g 2005-01-12T20:42Z
Marco
"Rachel Devons" wrote:
I've been able to set custom fields (metadata) on documents in SPS 2003
by
doing the following:
file.Item["<field name>"]="<field value>";
file.Item.Update();
Where file is a SPFile object that contains the document.
However, I have a field that is a date field and when I try to set this
field, I receive the error "Specified cast is invalid."
From what I understood, the metadata in SPS 2003 is all strings, so I'm
not
sure why I am getting this error. The document library was imported from
SPS
2001 using SPIN/SPOUT so perhaps that might have something to do with
it.
Can anyone shed any light on this? Do I need to cast the field value to
something? Any help would be greatly appreciated!
|
|
|
| Back to top |
|
 |
Rachel Devons
Guest
|
Posted:
Thu Jan 13, 2005 6:35 am Post subject:
Re: Setting metadata date fields in SPS 2003 |
|
|
I hadn't seen that, but the HTMLProp.dll issues seem to be related to
searching, right? I'm glad to have learned about something new, but it
doesn't seem that this is related to adding metadata, only searching it.
Ironically, I have no problems searching on the date field and have written
code to do it that works fine.
"Hollis D. Paul" <Hollis@outhousebythesound.com> wrote in message
news:VA.00001e1b.019f0feb@obts-outlookdev.outlookbythesound.mukwoods...
| Quote: | In article <#37dd9O#EHA.3820@TK2MSFTNGP11.phx.gbl>, Rachel Devons wrote:
Thanks for the post. I hadn't thought of that, but unfortunately, I am
still
getting the same error. I tried various ways of formatting the date, but
still the problem persists.
Any other ideas?
Did you catch this post that showed up today?
*********************
Search on Numeric property on Sharepoint 2003
From: "rdcpro" <rdcpro@hotmail.com
Newsgroups: microsoft.public.sharepoint.portalserver
Subject: Search on Numeric property on Sharepoint 2003
Date: 12 Jan 2005 13:27:47 -0800
I finally got resolution on the custom metadata and HTMLProp.dll issue.
In case the previous posts aren't available anymore, the issue is that
htmlprop.dll, found in the Windows Platform SDK, is supposed to convert
a variety of DateTime meta tags (with certain formats) to a DateTime
datatype, so that functions such as DATEADD() can be used in an SPS
query. You can't use CAST in a where clause (a limitation of the
MSSQLFT language), and by default all custom metadata is returned as
String.
A similar situation exists with integer types as well. The problem is,
no matter what I did, the custom metadata was always coming back as a
string. I followed all the instructions posted in the platform SDK,
plus a bunch that PSS provided, to no avail.
While this isn't documented anywhere, it turns out that this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SPSSearch\ContentIndexCommon\Filters\C |
LS
| Quote: | ID\{25336920-03F9-11CF-8FD0-00AA00686F13}
contained the GUID of nlhtml.dll, not HTMLProp.dll.
The GUID {25336920-03F9-11CF-8FD0-00AA00686F13} is used to identify
file and MIME types for HTML, GIF, JPEG, plain text and similar files.
It's sort of like an extension. I had placed the GUID of htmlprop.dll
in all the right places but this one, as it wasn't specified.
*********************
Hollis D. Paul [MVP - Outlook]
Hollis@outhousebythesound.com
Mukilteo, WA USA
|
|
|
| Back to top |
|
 |
|
|
|
|