I have a custom webpart that is displaying dynamic list data, it needs to render an image from a Picture Library (or at least provide me the URL so I can encapsulate it with an tag), however, none of the fields in the Picture Library seem to contain the image URL? Is there a 'image utility' (SPImageUtility) or something I can use to pull this out? Or am I simply missing something?
A:
Are getting information from a CAML query? If so you will need to add the required field to the query.
Otherwise the spListItem object from the spList has the property URL which has a web relative URL for the image.
Nat
2008-10-28 21:47:04
+1
A:
Assuming you are using the object model then the you should use this (c#)
SPListItem["EncodedAbsUrl"]
to get the HTML encoded absolute URL of the image (where "EncodedAbsUrl" is the name of the field/column).
To get the unencoded site relative url you can use ServerUrl or FileRef (they appear to return the same)
You can also use EncodedAbsThumbnailUrl to get a thumbnail image.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.aspx
Ryan
2008-10-30 01:14:09