Image slideshow using document library in SharePoint 2013

Leave a comment


1) How to genereate a image slideshow with using list in SharePoint 2013?
A) Concept:

backend: Sharepoint Documnet Library
Frontend animation: bxslider (js and Css)

Step -1:
Create a document library name it as: banners and add 3 images.

Step-2:
Create a sharepoint page and Insert banners list webpart.
After adding webpart. Go to webpart properties by edit properties.
In JS link give the paths of our CSR (JS file and bxslider.js file).

For example: ~site/Style Library/bx-slider.js|~site/Style Library/Generatebanner.js

Before we must add bxlider.js and its css files into style library.

Download those files at: http://bxslider.com/

Step-3:

Add CSR coding into our Generatebanner.js.

(function () {
loadCss(‘/sites/abc/Style%20Library/bxslider.css’);

function OnEventsViewPostRender(renderCtx) {
jQuery(document).ready(function(){

//write any jquery code if you want

});
}

function SliderscriptLoadSuccess(){}
function loadCss(url) {
var link = document.createElement(‘link’);
link.href = url;
link.rel = ‘stylesheet’;
document.getElementsByTagName(‘head’)[0].appendChild(link);
}

function OnEventsViewPreRender(renderCtx) {
}
function RenderBannerPhotos(renderCtx) {

var listData = renderCtx.ListData;
if (renderCtx.Templates.Body == ”) {
return RenderViewTemplate(renderCtx);
}
var bannersliderHtml = ”;

bannersliderHtml += ‘

‘;

bannersliderHtml += ‘

‘;

for (var idx in listData.Row) {
var listItem = listData.Row[idx];

var title = listItem.Title;
var itemID = listItem.ID;
var imgURl = listItem.FileRef;
var redirectURL=listItem.Url;

sniipet-lib-galleryslides

bannersliderHtml += divHTML;


}

bannersliderHtml += ‘

‘;
bannersliderHtml += ‘</div>’;
return bannersliderHtml;
}

function RenderEventsViewBodyTemplate(renderCtx) {
if(renderCtx.ListTitle == “BannerPhotos”) {
return RenderBannerPhotos(renderCtx);
}
}
function _registerEventsViewTemplate() {

var eventsViewContext = {};

eventsViewContext.Templates = {};
eventsViewContext.Templates.View = RenderEventsViewBodyTemplate;
eventsViewContext.OnPreRender = OnEventsViewPreRender;
eventsViewContext.OnPostRender = OnEventsViewPostRender;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(eventsViewContext);
}
ExecuteOrDelayUntilScriptLoaded(_registerEventsViewTemplate, ‘clienttemplates.js’);

})();

5) Refresh the page you will get images sliding

For any queries feel free to contact me

Advertisements

Latest Sharepoint 2010, 2013 interview questions

Leave a comment


  1. How do you call powershell script throught Sharepoint Page
  2. What is a worker process? What is the name of worker process fro timer job?
  3. How do you deploy master pages in production ?
  4. Location of webparts and masterpages in Sharepoint 2010?
  5. What are delegate controls In which way we can use them in sharepoint?
  6. How to convert asynchronous event handlers to synchronous ?
  7. What is meant by claims based authentication? Explain the process?
  8. Which is better CSOM or Rest Services?
  9. List event triggering twice how to stop that?
  10. What is an applicaton pool?
  11. What is a site definition Explain in detail?
  12. How many xml files does a sharepoint feature? What will be the case in timer job?
  13. What is the timer job class inherited from?
  14. Explain BCS connectivity in sharepoint 2010?
  15. What are modules in sharepoint 2010?
  16. XSLT is replaced by _____in sharepoint 2010?
  17. What is WSP? What is the use of that?
  18. Drawbacks of Runwith elevated previleages?
  19. What are the changes you noticed from sp2010 to sp2013 from developer perspective?
  20. What are the databases created when we create a new user profile service application?
  21. Explain sharepoint architecture?
  22. How to customize ribbon? explain about onet.xml file?
  23. What are the differences between webpart and visual web part?
  24. Idea on sandbox solutions?
  25. Write a caml query?
  26. How to retrieve a single item from sharepoint list with a condition using CAML? Explain step by step process?
  27. Custom search configuring and developing using sharepoint object model?
  28. Explain FBA how you configure it?
  29. What are contracts in WCF?
  30. Tell about SPwebapp,SPsite and SPweb?
  31. What are the override methods in a webpart?
  32. Step by step procedure of App model?
  33. What is managed meta data ?
  34. What is developer dashboard and how do you activate it and what details it will give?
  35. What are synchronous and Asynchronous event handlers?
  36. How do you design master page in sharepoint 2013 or sharepoint 2010?
  37. Differences between SPSite and SpWeb?
  38. What is Feature.xml and Elements.xml?
  39. What are restful services? Mention few of them?
  40. Write few powershell commands
  41. What are Application Pages? In which scenario we will use them?
  42. How can you set masterpages for different pages?
  43. What is SPFARM exactly?
  44. From which class Timerjob derived?
  45. Create custom properties for a webpart?
  46. What is a pagelayout and how it is different from master page?
  47. What is minimal download strategy ?
  48. Suppose you have a control on master page and want to show that to few members what we need to do?
  49. What are multiple document ready in javascript?
  50. What is content type hub?
  51. How many type of zones are there in sharepoint?
  52. More than 2 level groupBy is possible or not for sharepoint lists?
  53. What is distributed caching?
  54. What are the new service applications available in sharepoint 2013?
  55. What are the new features in sharepoint 2013?
  56. What is Rest API in SP2013?

Get current logged user in list event receivers?

Leave a comment


SPUser user = properties.Web.CurrentUser;

Mapping document icons using SPUtility.MapToIcon programatically in SharePoint 2013

1 Comment


Hi,

Using document library when we upload a document suppose if we upload a pdf document . You can see a small pdf icon.

Based on the document type the icons will map in Default Document Library in SharePoint 2013.

Similarly we need to get that while doing programmatically for that we can make use of  SPUtility.MapToIcon

The original location of icons in the server will be at: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\IMAGES

while in program the path will be like:http://doaminname:portnumber/_layouts/images/icdoc.png

string icon = SPUtility.ConcatUrls(“/_layouts/images”,SPUtility.MapToIcon(item.Web, SPUtility.ConcatUrls(objSPListItem.Web.Url, objSPListItem.Url), “”, IconSize.Size16));

Use Image Control in ASP.net

then

assign the

Image.Url=objSPListItem.Web.Url + icon;

Then you will get the icon related to the document type.

Note: SPUtility in sharepoint 2013 is a wonderful class which includes many useful methods.

Visit for more info: SPUtility

%d bloggers like this: