Instantly share code, notes, and snippets.
Front-End Developer near Raleigh, North Carolina. Lots of JavaScript, lots of SharePoint.
- Raleigh, NC
- https://PatrickDoran.com
- in/patrickdoran
PatD
/ SharePoint 2010 SP Services get list item counts in a collection
Created
January 21, 2015 21:23
SharePoint 2010 - SP Services - get list item counts in a collection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assumes jQuery and SP Services | |
// Outputs all lists and their item count | |
// From @sympmarc http://sympmarc.com/2010/09/19/down-and-dirty-spservices-solution-to-solve-an-emergency-request/ | |
$(document).ready(function() { | |
$().SPServices({ | |
operation: "GetAllSubWebCollection", | |
async: true, | |
completefunc: function (xData, Status) { | |
$(xData.responseXML).find("Web").each(function() { |
PatD
/ Sharepoint Bookmarklet: List Column Names on List Settings Page
Created
July 20, 2016 11:35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var fieldsTable=null;var tables=document.getElementsByTagName('table');for(var i=0;i<tables.length;i++){if(tables[i].innerHTML.toLowerCase().indexOf('fldedit.aspx')>-1||tables[i].innerHTML.toLowerCase().indexOf('managecontenttypefield.aspx')>-1){fieldsTable=tables[i];}}if(fieldsTable!=null){var th=fieldsTable.rows[0].insertCell(fieldsTable.rows[0].cells.length);th.innerHTML='Internal name';for(var i=1;i<fieldsTable.rows.length;i++){var link=fieldsTable.rows[i].cells[0].getElementsByTagName('a')[0].href;link=link.split('?')[1];link=link.split('&');for(var j=0;j<link.length;j++){if(link[j].indexOf('Field=')==0){link=link[j].split('=')[1];break;}};var td=fieldsTable.rows[i].insertCell(fieldsTable.rows[i].cells.length);td.innerHTML=unescape(link);}}})(); |
PatD
/ SharePoint Bookmarklet: Get Fields - Takes List Name as input and outputs all fields with internal names on console
Created
July 20, 2016 11:36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(w){if("undefined"===typeof jQuery){var jq=document.createElement("script");jq.type="text/javascript";jq.src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";document.getElementsByTagName("head")[0].appendChild(jq)}var requestHeaders={Accept:"application/json;odata=verbose","X-RequestDigest":jQuery("#__REQUESTDIGEST").val()};var iList=w.prompt("Please enter the list name","Tasks");var a=jQuery.ajax({url:_spPageContextInfo.webAbsoluteUrl+"/_api/lists/getbytitle('"+iList+"')?$select=Fields&$expand=Fields",type:"POST",contentType:"application/json;odata=verbose",headers:requestHeaders,success:function(data){console.log(data);var fields=data.d.Fields.results,f={};for(i=0;i<fields.length;i++){console.log("Title: "+fields[i].Title+" | "+"Internal Name: "+fields[i].InternalName+" | "+"Type: "+fields[i].TypeAsString+" | "+"GUID: "+fields[i].Id+" ");var _f={Title:fields[i].Title,InternalName:fields[i].InternalName,Type:fields[i].Type,GUID:fields[i].GUID,meta:fields[i]};console.log(_f); |
PatD
/ SharePoint Bookmarklet: Workflow History - Link to hidden list
Created
July 20, 2016 11:40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(w){ w.location.href = ('undefined' !== typeof _spPageContextInfo ? _spPageContextInfo.webAbsoluteUrl : w.location.origin + L_Menu_BaseUrl) + "/Lists/Workflow%20History";})(window); |
PatD
/ SharePoint Bookmarklet: Workflow Management - Link to a page that displays all the workflows in the site
Created
July 20, 2016 11:40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (w) { w.location.href = ('undefined' !== typeof _spPageContextInfo ? _spPageContextInfo.webAbsoluteUrl : w.location.origin + L_Menu_BaseUrl) + "/_layouts/wrkmng.aspx"; })(window); |
PatD
/ SharePoint Bookmarklet: Total Webparts on a page - Lists all the webparts on a specific page
Created
July 20, 2016 11:42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (w) { w.location.href = ('undefined' !== typeof _spPageContextInfo ? _spPageContextInfo.webAbsoluteUrl : w.location.origin + L_Menu_BaseUrl) + "?contents=1"; })(window) |
PatD
/ SharePoint Bookmarklet: Taxonomy hidden list - link to Taxonomy hidden list
Created
July 20, 2016 11:43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (w) { w.location.href = ('undefined' !== typeof _spPageContextInfo ? _spPageContextInfo.webAbsoluteUrl : w.location.origin + L_Menu_BaseUrl) + "/Lists/TaxonomyHiddenList/AllItems.aspx"; })(window) |
PatD
/ SharePoint Bookmarklet: Change User
Created
July 20, 2016 11:45
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function (w) { w.location.href = ('undefined' !== typeof _spPageContextInfo ? _spPageContextInfo.webAbsoluteUrl : w.location.origin + L_Menu_BaseUrl) + "/_layouts/closeConnection.aspx?loginasanotheruser=true";})(window) |
PatD
/ createListItem.js
Created
February 27, 2017 02:38
SharePoint Create List Item with JavaScript. Shows response w/SP.UI.Notify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function that creats a list item. | |
// Expects a title and category to be passed to it. | |
function createListItem(titleText,categoryText) { | |
// Where are we in SharePoint? | |
var _clientContext = SP.ClientContext.get_current(); | |
// SharePoint List name | |
var _talkList = _clientContext.get_web().get_lists().getByTitle('list name'); | |
PatD
/ SharePoint 2016 - Make Ribbon look like 2013
Created
September 19, 2018 14:51
Makes an on-premise SharePoint 2016 ribbon look/work like the 2013 Ribbon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
/* SP2016 Ribbon adjustments */ | |
/* Puts babysuiteBar in the corner */ | |
#suiteBarDelta {position: absolute;top:0;right:0;max-width:300px;} | |
/* Hides Waffle button */ | |
#suiteBarDelta .o365cs-nav-leftAlign {display:none;} | |
/* Hides About Me in dropdown */ |
OlderNewer