Unable to see more than 100 Items from SharePoint list using Rest API

Leave a comment


In your custom list which is having more than 500 records. When you query with REST API it returns only 100 records.

Eg: http://<domain>/<site url>/_api/web/lists/GetByTitle(‘ListName’)/items

Solution:
To override that you need to append $top=3000 or $top=5000

Eg: http://<domain>/<site url>/_api/web/lists/GetByTitle(‘ListName’)/items?$select=AuthorId&$top=3000

Here authorId is CreatedBy Column.

Feel free to email me at bharath.chennu@onetidbit.com

 

 

Advertisements

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

Using list service to display data in sharepoint site page

Leave a comment


Situation: Need to display a set of data in sharepoint list based on a dropdown in the page. For that if we plan to write a visualwebpart. But while changing the values in the dropdown Postbacks will occur which will be not smooth.

To handle this is in a simple way we can use 1) Ajax 2) List service.

Here I will explain with List service.

1) Create a Sharepoint list “EmployeeList”

2) The list service will be accessed as: http://abc:123/_vti_bin/ListData.svc/EmployeeList (This is an example)

3)Now we need to create a new page in Sitepages.

4) In that new page insert a Content Editor  Web Part (CEWP)

5) Now Open a Notepad and write your Jquery code and save it as Employee.JS and give a reference in the new page created.

Point to remember: You must place the js reference link only in between the PlaceHolderAdditionalPageHead. nOT ONLY .JS  we can refer .css files also in PlaceHolderAdditionalPageHead.

<asp:Content ContentPlaceHolderId=”PlaceHolderAdditionalPageHead” runat=”server”>

<script type=”text/javascript” src=”/SitePages/employee.js”></script>

</asp:Content

6) After referencing write a code in employee.js to retrieve all the list data and show them or render it in a tabular form

7) employee.js

$(document).ready(function() {

var url=” http://abc:123/_vti_bin/ListData.svc/EmployeeList ” ;

$.getJSON(url,function(data) {
var count = 0;
html= “<table>”;
$.each(data.d.results, function(i,result) {
if(result.Employee!=null)
{
var title = result.Title;
var emp=result.Employee;
var empid=result.EMPID;
if(count==0)
{
html+=”<tr><th><b>Employee</b></th><th><span><b>EMPID</b></th></tr><tr><td><b>”+emp+”</b></td><td><span><b>”+empid+”</b></td></tr>”;

html+=”</div>”;
}

else

{

//dont need headers again here

html+=”<tr><td><b>”+emp+”</b></td><td><span><b>”+empid+”</b></td></tr>”;

}

count = count +1;

}

});
html+=”</tr>”;
html+=”</table>”;
$(‘#Result’).append($(html));

});

8) now we need a content editor webpart to render our html output. here we given according to jquery with a div

<div id=”Result” style=”font-size: 10px; color: blue”></div>

9)take a text file and copy above html code and link that with content editor webpart

10) Then in browser it will render all table data

Suppose if you want filter data with some specific value you must give list service url as like this:

http://abc:123/_vti_bin/ListData.svc/EmployeeList?$filter=EMPID eq ‘1234’ ”

References:

https://msdn.microsoft.com/en-us/library/lists%28v=office.12%29.aspx

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

Error “Admin SVC must be running in order to create deployment timer job”

Leave a comment


Hi All,

While Deploying a WSP solution into a WebApplication in Powershell. You may face the issue or error as:

Admin SVC must be running in order to create deployment timer job”

To rectify it:

Just go to Enable the Services of SharePoint Administrator.

Go To Command Prompt and Type Services.msc. You will see a window contains all the list of services running.

Enable “SharePoint 2010 Administration” service.

Service name: SPAdminV4
Display Name: SharePoint 2010 Administration

Once you have Enabled or Started it that the command will run smoothly.

The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

Leave a comment


Hi All,

Dont get panic after seeing this huge error message in your SharePoint 2010 page.

Usually when you restore a Database to the database related to sharepoint application.

In my case when I restore a database to the old db of SharePoint site it occureed. To see the exact error we need to do little changes in the web.config of ” Security Token Service Application”.

Location of Security Token Service Application.

1) Open IIS.

2) Click Sites Folder

3) Click SharePoint Web Services (Small Globe Icon)

4) There at bottom you can see Security Token Service Application.

5) Right click and click Explore. There Open its web.config file and do the changes.

<!– Behavior List: –>
<behaviors>
<serviceBehaviors>
<behavior name=”SecurityTokenServiceBehavior”>
<!– The serviceMetadata behavior allows one to enable metadata (endpoints, bindings, services) publishing.
This configuration enables publishing of such data over HTTP GET.
This does not include metadata about the STS itself such as Claim Types, Keys and other elements to establish a trust.
–>

<serviceMetadata httpGetEnabled=”true” />

<serviceDebug httpHelpPageEnabled=”true” includeExceptionDetailInFaults=”true” />

<!– Default WCF throttling limits are too low –>

<serviceThrottling maxConcurrentCalls=”65536″ maxConcurrentSessions=”65536″ maxConcurrentInstances=”65536″ />

</behavior>

</serviceBehaviors>

</behaviors>

Add an assembly (.dll) to the GAC manually – .NET

Leave a comment


Situation: While Publishing ASP.NET files onto the remote server there will be no visual studio tools like gacutil.exe. So we can get doubt how can we add assemblies into gac folder (C:\windows\assembly\) without using gac. Here is the solution.

Solution:

1) Go to local Security Policy in windows 7.

Localsecuritypolicy

 

2) Goto Local Policies ——> Security Options—> User Account Control: Run All Administrators in Admin Approval Mode

 

UAC

UAC

 

 

3) By Default it will be Enabled . Disable it and Add the dlls into C:\windows\Assembly\

 

UAC Enable

UAC Enable

4) After adding again enable it and enjoy !!!

 

 

Older Entries

%d bloggers like this: