Some valuable information on SharePoint 2010,2013
Thursday, December 31, 2020
Tuesday, December 15, 2020
JQ Grid Examples
JQ Grid Examples:
=============
http://www.ok-soft-gmbh.com/jqGrid/ActionButtons.htm
http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithInlineEditingOnEnter.htm
http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithInlineEditingAndHide.htm
https://www.ok-soft-gmbh.com/jqGrid/OK/performane-13-5000-25-free-jqgrid.htm
http://www.ok-soft-gmbh.com/jqGrid/SubgridWithLocalGrid.htm
http://www.ok-soft-gmbh.com/jqGrid/OK/LocalAdjacencyTree-expandCallapsAll.htm
http://www.ok-soft-gmbh.com/jqGrid/OK/performane-1000-free-grid-groupingAll.htm
Friday, November 27, 2020
Convert JSON object array to c# class
requestIds ="JSON array object"
JsonTextReader reader = new JsonTextReader(new System.IO.StringReader(requestIds));
JsonSerializer serializer = new JsonSerializer();
var objContent = serializer.Deserialize(reader).ToString();
JArray objArray = null;
try
{
objArray = JArray.Parse(objContent);
}
catch (Exception ex)
{
objContent = "[" + objContent + "]";
}
IList<SubscriptionObject> arrarylist = Newtonsoft.Json.JsonConvert.DeserializeObject<IList<SubscriptionObject>>(objContent);
Thursday, September 17, 2020
Getting data through Web API from SQL and implementing in Ajax call in SharePoint content editor web part (Dashboard Refresh API, )
Javascript in CE webpart:
-----------------------------------
function GetDashboardRefreshDetails(dashBoardName) {
//var listURL ="https://team.amat.com/sites/BIM_QA";
//var url ="/_api/Web/Lists/GetByTitle('BIM Search')/Items?$select=Name,ContentType0,link,BusinessOwningFunction,Active&$filter=BusinessOwningFunction eq '"+pageName+"' and Active eq 1";
var url = "http://spqaappweb.amat.com/DashboardRefreshAPI/API/DashboardAPI?dashboardName='"+dashBoardName+"'";
//var url = "http://localhost:50565/Api/DashboardApi";
$.ajax({
url: url,
type: 'GET',
crossDomain: true,
dataType: 'jsonp',
contentType: "application/json; charset=utf-8",
success : function(response) {
Getdata(response);
},
error: function (error) {
// alert(JSON.stringify(error));
}
});
}
function Getdata(response){
if(response.length > 0){}
}
======================================================================
C# controller code:
--------------
public void GetRefreshDetails(string dashboardName)
{
dashboardName = dashboardName.Substring(1, dashboardName.Length - 2);
BAL obj = new BAL();
List<BAL> objList = obj.GetRefreshData(dashboardName);
StringBuilder sb = new StringBuilder();
JavaScriptSerializer js = new JavaScriptSerializer();
var callBackFunction = HttpContext.Current.Request["callback"];
sb.Append(callBackFunction + "(");
sb.Append(js.Serialize(objList));
sb.Append(");");
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/json";
HttpContext.Current.Response.Write(sb.ToString());
HttpContext.Current.Response.End();
// return objList;
}
[WebMethod()]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public void GetToolsCount()
{
ToolsData obj = new ToolsData();
List<ToolsData> objList = obj.GetToolsCount();
StringBuilder sb = new StringBuilder();
JavaScriptSerializer js = new JavaScriptSerializer();
var callBackFunction = HttpContext.Current.Request["callback"];
sb.Append(callBackFunction + "(");
sb.Append(js.Serialize(objList));
sb.Append(");");
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "application/json";
HttpContext.Current.Response.Write(sb.ToString());
HttpContext.Current.Response.End();
// return objList;
}
}
Wednesday, May 13, 2020
Get More than 5000 records from SharePoint list by rest API through recursive call
Get More than 5000 records from SharePoint list by rest API through recursive call
--------------------------------------------------------------------------------
$(document).ready(function(){
GetListItems();
});
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('ECO_Documents')/items?$top=4999&$orderby=ID";
var response = response || []; // this variable is used for storing list items
function GetListItems(){
return $.ajax({
url: url,
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: function(data){
response = response.concat(data.d.results);
if (data.d.__next) {
url = data.d.__next;
// console.log(url);
GetListItems();
}
},
error: function (error) {
alert(JSON.stringify(error));
}
});
}
Saturday, April 25, 2020
Autocomplete text box , content directly from AD, Name, Email etc
Autocomplete text box , content directly from AD, Name, Email etc
---------------------------------------------------------------------
[WebMethod]
public static List<UserProperty> GetADUsers(string username)
{
List<UserProperty> lstADUsers = new List<UserProperty>();
if (!string.IsNullOrEmpty(username))
{
using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
{
UserPrincipal user = new UserPrincipal(context);
user.DisplayName = username + "*";
using (PrincipalSearcher srch = new PrincipalSearcher(user))
{
int i = 0;
foreach (var result in srch.FindAll())
{
DirectoryEntry de = result.GetUnderlyingObject() as DirectoryEntry;
if (!String.IsNullOrEmpty((String)de.Properties["displayName"].Value))
{
i++;
UserProperty usp = new UserProperty();
usp.UserName = de.Properties["displayName"].Value.ToString();
if (de.Properties["mail"].Value != null)
usp.Email = de.Properties["mail"].Value.ToString();
//if (de.Properties["EmployeeId"].Value != null)
//{
// usp.EmpId = de.Properties["EmployeeId"].Value.ToString();
//}
//else
// usp.EmpId = string.Empty;
lstADUsers.Add(usp);
if (i == 10) break;
}
}
}
}
}
return lstADUsers;
}
Wednesday, January 8, 2020
Auto Generate New Id in MS SQL in Procedure
GO
/****** Object: StoredProcedure [dbo].[GetRequestNo] Script Date: 1/8/2020 6:11:35 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--EXEC GetRequestNo
ALTER PROCEDURE [dbo].[GetNewCIF_ID]
AS
BEGIN
DECLARE @RequestNo varchar(20),@maxCount bigint
select @maxCount = count(*) from [dbo].[CIF_Requests]
if(@maxCount <> 0)
SET @RequestNo = 'TIF_'+RIGHT('000000' + CONVERT(nvarchar(20), @maxCount + 1), 6)
else
SET @RequestNo = 'TIF_'+RIGHT('000000' + CONVERT(nvarchar(20), 1), 6)
SELECT @RequestNo
END