Select to view content in your preferred language

Select features of sharepoint list layer via query

634
3
11-05-2010 06:29 AM
ChadCollins
Emerging Contributor
Hello, I am attempting to write a query tool that allows the users to search by attributes of a sharepoint list layer.  Presently the tool searches the sharepoint list and creates a graphic layer using the data (thanks Rich for your examples), however because I am utilizing a lot of lookup fields and URLs in the SharePoint list, those links are not coming through into the graphic layer.  So I am hoping there is a way I can interact with the SP List layer and select the features that meet the search criteria. Optionally, ideas on how to get links populating in a graphics layer may be a workaround solution too.  Any ideas would be greatly appreciated.

Thank you,
Chad.
0 Kudos
3 Replies
RichZwaap
Frequent Contributor
Hi Chad:

I'm not sure I understand exactly what you're having trouble with.  You should be able to access any of the fields in the list using SharePoint's Silverlight Client OM as shown in the samples.  If you're having difficulty constructing the CAML query, you could try the U2U CAML Query Builder.  I haven't tried it against 2010 myself, but many folks online say it still works.  Which makes sense, given that it communicates using SharePoint's asmx services, where are still there at 2010. 

As to getting links into a graphics layer, if you add a URL to a graphic's attributes collection, it should show up as a hyperlink in the graphic's pop-up (i.e. when you hover over it).

Hope this helps.
0 Kudos
ChadCollins
Emerging Contributor
Thanks for the reply Rich.  I have been able to write CAML to interact with the SharePoint lists (and consequently create graphic layers).  What I was curious about doing was interacting with list layer within the map (not adding a new layer comprised of the 'selected' features, but selecting\highlighting features from an existing layer that is sourced from the SharePoint list).

As for adding the URL, when I add a hyperlink column from my list when building the graphic layer, it merely populates the field with 'Microsoft.SharePoint.Client.FieldUrlValue' in both the map table and pop-up.  There must be some sort of conversion that can extract the actual URL, right?

Thank you again,
Chad.
0 Kudos
RichZwaap
Frequent Contributor
Once you get the values back from the SharePoint list, you'll need to convert them to strings before adding them to the attributes collection.  For instance, if memory serves, SharePoint hyperlink fields come back with two values - one for the description, one for the URL.  If you want to show the URL in the pop-up, you'll need to extract this value as a string and put this in the attributes collection.

As to selection, you should get this as part of adding your graphics layer to the map.   Note however, if you are defining the symbol programmatically, you'll have to make sure that the symbol has a selected state.

Hope this helps.
0 Kudos