Querying a Hyperlink field using CAML

Recently I had a requirement to search for items with a certain URL in the Hyperlink field.

I noticed that the value being stored in the Hyperlink field is of the format ,. The is an absolute URL.

Using a CAML query that searches for a matching absolute URL returns no result. It turns out that I have to drop the ‘http://serverName’ from my query. So if the URL I wanted to search on was ‘http://myServer/mySite/lists/…’, then I would just search on ‘/mySite/lists/…’ in the CAML, and I would still use the Eq operator.

Here ‘myServer’ is the name of my current SharePoint server. It would be interesting to see what would happen if myServer was a DNS to some other non-SharePoint website.

Advertisement

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in CAML, SharePoint. Bookmark the permalink.

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 )

Facebook photo

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

Connecting to %s