Category Archives: Uncategorized

How to get current user id and name in Sharepoint 2013 using Ecma Script

var userid; function GetUserDetails() { clientContext = new SP.ClientContext.get_current(); var oWeb = clientContext.get_web(); currentUser = oWeb.get_currentUser(); clientContext.load(currentUser); clientContext.executeQueryAsync(function () { userid = currentUser.get_id(); usertitle = currentUser.get_title(); }, function (error) { alert(‘Request failed: ‘); }); }

Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

How to get logged in user image in SharePoint 2013 (MySite)

$.ajax({ url: _spPageContextInfo.webAbsoluteUrl + “/_api/SP.UserProfiles.PeopleManager”+ “/GetMyProperties?$select=PictureUrl,DisplayName,AccountName”, type: “GET”, contentType: “application/json;odata=verbose”, headers: { “accept”: “application/json;odata=verbose” }, async: false, success: function (data) { var pic = data.d.PictureUrl; var member = data.d.DisplayName; if (pic) { $(“#userName”).text(member); $(“#paduserName”).text(member); $(“.imageicon”).attr(“src”,pic.Url); } else { $(“#userName”).text(member); $(“#paduserName”).text(member); … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

ALTER DATABASE Compatibility Level (Transact-SQL)

ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = { 90 | 100 | 110 } Arguments database_name Is the name of the database to be modified. COMPATIBILITY_LEVEL { 90 | 100 | 110 } Is the version of SQL Server with which … Continue reading

Posted in Uncategorized | Leave a comment

Port for Sql Server

TCP/IP port numbers are which Microsoft SQL Server requires to communicate over a firewall. The default SQL Server port is 1433, and client ports are assigned a random value between 1024 and 5000.

Posted in Uncategorized | Leave a comment

Export in Excel from datatable

// these namespaces need to be added to your code behind fileusing System.Configuration;using System.Data.SqlClient;using System.Data; namespace MySpot.UserPages{    public partial class Journal : System.Web.UI.Page    {        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[“MySpotDBConnStr”].ConnectionString);        DataTable dt = new DataTable();                // regular page_load from .aspx file        … Continue reading

Posted in Uncategorized | Leave a comment