문제

I have a requirement where there will be a single Picture Library for the entire application and all application images will be there, I want a URL column in the Picture Library View where user can copy the URL and use it for certain functionalities.

도움이 되었습니까?

해결책

One option is to use JSLink to populate the image Url. Create a column called "ImageUrl" and use below script to populate the field value.

(function () {

var imageUrlFiledTemplateContext = {};
imageUrlFiledTemplateContext.Templates = {};
imageUrlFiledTemplateContext.Templates.Fields = {

    'ImageUrl': { 'View': ImageUrlFiledTemplate }
};

SPClientTemplates.TemplateManager.RegisterTemplateOverrides(imageUrlFiledTemplateContext);

})();

function ImageUrlFiledTemplate(ctx) {
    var imageUrl = _spPageContextInfo.webAbsoluteUrl + ctx.listUrlDir + "/" + ctx.CurrentItem.FileLeafRef;
    return imageUrl;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top