error in using SPList for searching custom properties.
From: Robert Nase (anonymous_at_discussions.microsoft.com)
Date: 03/04/04
- Next message: Seb: "Re: How to get the sub area of the current area programmatically"
- Previous message: Robart: "Re: Customize/Modify Search.asmx for custom search?..."
- In reply to: sonal: "error in using SPList for searching custom properties."
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Mar 2004 00:44:37 -0800
Hi,
Thanks. May be you are true. Can anyone help me how to
retrieve the all versions of documents in a search
result.I can see the all document versioned when I click
version history on a document dropdown menu?
Thanks again.
Robert
>-----Original Message-----
>i am trying to use the SPlist class for searching the
custom properties of the document. I have a custom
property called 'Status' and i want to search all docs
having Status = comp.
>i am getting error as
>"An unhandled exception of
type 'Microsoft.SharePoint.SPException' occurred in
microsoft.sharepoint.dll
>
>Additional information: No such field name
>
>No field was found with that name. Check the name, and
try again."
>
>This error i am getting on line:
>
>Dim items As SPListItemCollection = list.GetItems(query).
>
>The full code is as follows.
>Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
> Dim site As SPSite
> site = New SPSite
("http://lb102server/sites/batchrun2")
> Dim webcoll As SPWebCollection = site.AllWebs
> Dim web As SPWeb
> Dim query As New SPQuery
> query.Query = "<Where><Eq><FieldRef
Name='status'></FieldRef><Value
Type='Text'>comp</Value></Eq></Where>"
>
> For Each web In webcoll
> Dim listcoll As SPListCollection = web.Lists
> Dim list As SPList
> For Each list In listcoll
> If list.BaseType =
SPBaseType.DocumentLibrary Then
> If list.BaseTemplate <>
SPListTemplateType.XMLForm Then
> Try
> 'Following line is throwing
exception
> Dim items As
SPListItemCollection = list.GetItems(query) 'list.Items
>
> Dim item As SPListItem
>
> For Each item In items
>
> MessageBox.Show
(SPEncode.HtmlEncode(item("Title").ToString()) & "<BR>")
>
> Next item
> Catch ex As Exception
>
> MessageBox.Show(ex.Message)
>
> End Try
> End If
> End If
> Next
> Next
>
> End Sub
>
>
>Hoping to get a quick response.
>
>Thanks & Regards,
>Sonal
>
>.
>
- Next message: Seb: "Re: How to get the sub area of the current area programmatically"
- Previous message: Robart: "Re: Customize/Modify Search.asmx for custom search?..."
- In reply to: sonal: "error in using SPList for searching custom properties."
- Messages sorted by: [ date ] [ thread ]