I had hard time to get the complete Url of the picture as well thumbnail directly (using any property) inserad of managing with server relative/absolute url, thumbanil folder /t and the picture name.
But we have full control through SPObject Model(SPBuiltInField class) to get the picture/thumbnail Url directly.
To get the absolute, relative Urls of the picture the Url can be managed as below.
But we have full control through SPObject Model(SPBuiltInField class) to get the picture/thumbnail Url directly.
SPList spList = web.Lists["ImagesLibrary"];The above Urls are the full Urls of the thumbnail and picture respectively.
SPListItem item = spList.Items.GetItemById(itemID);
//Thumbnail Url
string thumbnailUrl = item[SPBuiltInFieldId.EncodedAbsThumbnailUrl].ToString();
//Picture Url
string pictureUrl = item[SPBuiltInFieldId.EncodedAbsUrl].ToString();
To get the absolute, relative Urls of the picture the Url can be managed as below.
Uri uri = new Uri(thumbnailUrl);
string relativePath = uri.AbsolutePath;
Nice post.thanks for this dude.
ReplyDelete.Net application development
Great Post!!! Thank you!
ReplyDelete