How to Search List Items of Windows SharePoint Services


This code searches through WSS(Windows SharePoint Services) for Specific List Item…. by Title…….
 
 
 

For Each SPVirtualServer In SPGlobalAdmin.VirtualServers

If (SPVirtualServer.State = SPVirtualServerState.Ready) And (SPVirtualServer.ContentDatabases.Count > 0) And (SPVirtualServer.Description <> "Adminstration") Then

For Each spsite In SPVirtualServer.Sites

For Each spweb As SPWeb In spsite.AllWebs

For Each splist As SPList In spweb.Lists

If (splist.Items.Count > 0) Then

For Each SPListItem As SPListItem In splist.Items

If (SPListItem.Item("Title") = itemname) Then

FrmItemSearch.LvSearchResults.Items.Add(spweb.Url.ToString)

FrmItemSearch.LvSearchResults.Items(i).SubItems.Add(splist.Title.ToString)

i = i + 1

End If

Next

End If

Next

Next

Next

End If

Next

If (i = 0) Then

MessageBox.Show(

"List Item not found", "Item not found", MessageBoxButtons.OK, MessageBoxIcon.Information)

Else

MessageBox.Show(

"Search complete…", "Search Complete", MessageBoxButtons.OK, MessageBoxIcon.Information)

End If

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: