Skip to content

Instantly share code, notes, and snippets.

View rjesh-git's full-sized avatar
🚀

Rajesh Sitaraman rjesh-git

🚀
View GitHub Profile
@rjesh-git
rjesh-git / Crossdomain.js
Last active August 29, 2015 14:10
Cross domain call from SharePoint
'use strict';
var context = SP.ClientContext.get_current()
(function () {
var request = new SP.WebRequestInfo();
var response;
$(document).ready(function () {
request.set_url("http://services.odata.org/Northwind/Northwind.svc/Categories");
request.set_method("GET");
@rjesh-git
rjesh-git / default.aspx
Last active August 29, 2015 14:10
Aspx page for cross domain call
<div>
<p id="categories">
initializing...
</p>
</div>
rjeshns.getUserProperty = function (profileProperty) {
var deferred = $.Deferred();
var clientContext = new SP.ClientContext.get_current();
var peopleManager = new SP.UserProfiles.PeopleManager(clientContext);
var personProperties = peopleManager.getMyProperties();
clientContext.load(personProperties);
clientContext.executeQueryAsync(
Function.createDelegate(this,
@rjesh-git
rjesh-git / PeopleDefaultValue.js
Created March 16, 2015 04:08
Default Value for People Column
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var userid = _spPageContextInfo.userId;
function GetCurrentUser() {
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
@rjesh-git
rjesh-git / PublishingPageCreation.ps1
Last active August 29, 2015 14:17
Creating publishing pages using PowerShell CSOM
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Publishing.dll"
$siteUrl = "https://YOUR SITE URL"
# - use appropriate login methods
#$username = Read-Host -Prompt "Enter Username"
#$password = Read-Host -Prompt "Enter password" -AsSecureString
#$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
@rjesh-git
rjesh-git / default.aspx
Last active October 16, 2015 02:41
localizer sample aspx
<%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%>
<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jqu
@rjesh-git
rjesh-git / resource.fr-FR.js
Created October 15, 2015 22:50
Localization Sample Resource file - French
var resources = [];
resources.PageTitle = "localisation échantillon";
resources.HeaderText = "Bonjour le monde!";
resources.ParaText = "Ceci est une unité de héros simple, un composant simple jumbotron style pour appeler une attention particulière aux contenus ou informations sélectionnée.";
resources.BtnTextLearnMore = "Apprendre encore plus";
@rjesh-git
rjesh-git / sample.js
Last active October 16, 2015 05:27
Passing parameter to localizer.Init()
localizer.Init({
defaultLang: 'fr-FR',
cache: false
});
var exportExcel = function () {
var selecteditems = SP.ListOperation.Selection.getSelectedItems();
currentListGuid = SP.ListOperation.Selection.getSelectedList();
var context = SP.ClientContext.get_current();
currentSite = context.get_site();
currentWeb = context.get_web();
var currentList = currentWeb.get_lists().getById(currentListGuid);
var aAlert = function() {
alert('hi there');
}