Wednesday, September 3, 2014

SharePoint 2013 access image URL for custom image field on a page

When you have a custom field on a SharePoint page's properties (of image type) it can be necessary to simply get the image's URL rather than dealing with an image object. We can access the image URL (as a string) by using the following method.

You can also access other fields of simple types (such as text) by using the following code:
var myTextField = (string)SPContext.Current.File.Item["TextFieldName"];

No comments:

Post a Comment