Showing posts with label SPServices. Show all posts
Showing posts with label SPServices. Show all posts

Wednesday, March 2, 2016

How to retrieving next 7 Days Due Date Tasks from SharePoint List

C# Coding:


DateTime strdate = (DateTime)DateTime.Today.AddDays(7);
            string strgetDate = strdate.Year + "-" + strdate.Month + "-" + strdate.Date.Day;

SPWeb currentWeb = SPContext.Current.Web;
            SPList lst = currentWeb.Lists["Projects"];
            SPQuery sQuery = new SPQuery();
            sQuery.Query = "<Where><Geq><FieldRef Name='DueDate' /><Value Type='DateTime'>"+strgetDate+"</Value></Geq></Where><OrderBy><FieldRef Name='DueDate' /></OrderBy>";
            SPListItemCollection myColl = lst.GetItems(sQuery);
            if (myColl.Count > 0)
            {
                grdBind.DataSource = myColl.GetDataTable();
                grdBind.DataBind();
            }

Batch Command Update for Insert the records into a SharePoint list

var query = "<Batch OnError='Continue' RootFolder='" + RootFolder + "' ViewName=''>";

for (var i = 0; i < data.length - 1; i++)
{

 query += "<Method ID='1' Cmd='New'>";
        query += "<Field Name='Title'>" + DocTitle;
        query += "</Field>";
        query += "<Field Name='GrpTitle'>" + GrpTitle;
        query += "</Field>";
        query += "<Field Name='Category'>" + catID;
        query += "</Field>";
        query += "<Field Name='SubCat'>" + subCategory[i];
        query += "</Field>";
        query += "<Field Name='DispOrder'>" + DispOrder;
        query += "</Field>";
        query += "<Field Name='DocID'>" + DocID;
        query += "</Field>";
        query += "<Field Name='DocURL'>" + DocURL;
        query += "</Field>";
        query += "<Field Name='DocDesc'>" + DocDesc;
        query += "</Field>";
        query += "<Field Name='DocType'>" + DocType;
        query += "</Field>";
        query += "</Method>";

}
 query += "</Batch>";
var resf = oLists.updateListItems("lstDocOrder", query);

$().SPServices.SPArrangeChoices not working in SPServices

Its working fine
Please download lastest version 2014
https://spservices.codeplex.com/


<script type="text/javascript">

$(document).ready(function() {

$().SPServices.SPArrangeChoices({
columnName: "Research Fee Received",
perRow: 2
});

});</script>

Friday, February 12, 2016

How to update bulk items and all items in custom list using SPServices

In this article,bulk updatein sharepoint list
 <input id="btnUpdateItem" type="button" value="Delete all items" />
jQuery:
$('#btnUpdateItem').click(function()
{
UpdateAction();
});
function UpdateAction()
{
$().SPServices.SPUpdateMultipleListItems({
  listName: "SupportTable-OLEMData",
  CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where></Query>",
  valuepairs: [["Status", "Inactive"]]
});
alert("All items are updated!");
}

How to delete bulk items and all items in custom list using SPServices

<input id="btnDeleteItem" type="button" value="Delete all items" />


$('#btnDeleteItem').click(function()
{


DeleteAction();

});


function DeleteAction()
{
$().SPServices.SPUpdateMultipleListItems({
  listName: "SupportTable-OLEMData",
  CAMLQuery: "<Query><Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where></Query>",
  batchCmd: "Delete"
});
alert("All items are deleted!");
}