Skip to content

Instantly share code, notes, and snippets.

View star-crossed's full-sized avatar

Paul Choquette star-crossed

  • Everett, WA
View GitHub Profile
@star-crossed
star-crossed / spsetnavigateformscalendar.js
Last active August 29, 2015 14:03
SharePoint: Set NavigateForFormsPages on the ctx object for calendar web parts (JavaScript)
function _spAjaxCalendarInitWPQ2(){
SP.UI.ApplicationPages.CalendarContainerFactory.create(document.getElementById('ctl00_ctl39_g_e223e6e7_613f_4a25_9890_7e9ab8f57f71_ctl01_ctl00_ctl00'),{ctxId:'WPQ2',dataSources:[{id:'00000000-0000-0000-0000-000000000000',name:'',color:'',formUrl:'\u002fLists\u002fCRS\u002fDispForm.aspx',primary:true, disableDrag:false},{id:'5cf6ddba-4e28-4ae4-be8d-7004029b0bdb',name:'17th Floor Conference Room',color:'1',formUrl:'\u002fLists\u002fCRS\u002fDispForm.aspx',primary:false, disableDrag:true},{id:'b87ee40d-0f17-409a-973c-c5982c9ce9fe',name:'47th Floor SMALL Conference Room',color:'3',formUrl:'\u002fLists\u002fCRS\u002fDispForm.aspx',primary:false, disableDrag:true},{id:'05f83944-7acd-4419-922c-3adb450bae19',name:'48th Floor SMALL Conference Room',color:'5',formUrl:'\u002fLists\u002fCRS\u002fDispForm.aspx',primary:false, disableDrag:true},{id:'5aae0de3-6c9f-4614-8f9c-ebfece94c56f',name:'48th Floor LARGE Conference Room',color:'6',formUrl:'\u002fLists\u002fCRS\u002fDispForm.aspx',p
@star-crossed
star-crossed / RemoveTooltips.js
Last active August 29, 2015 14:15
Remove tooltips from ASP.NET Calendar control
$(document).ready(function () {
$("table[title='Calendar']").find("a[title]").removeAttr("title");
});
@star-crossed
star-crossed / spunfollowuser.ps1
Last active August 29, 2015 14:24
SharePoint 2013: Unfollow a user (PowerShell)
$userName = "User account you want to modify goes here"
$site = Get-SPSite "URL for SP site goes here"
$serviceContext = Get-SPServiceContext($site)
$profileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
if($profileManager.UserExists($userName))
{
@star-crossed
star-crossed / spdocsbyfilter.ps1
Last active August 29, 2015 14:25
SharePoint PowerShell Script to Get Documents Filtered by a Column
Add-PSSnappin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb "your url here"
$list = $web.Lists["your doc lib title here"]
$docs = $list.Items | Where-Object { $_["your choice column name here"] -eq "your choice here" } | $_.File | % {
# do something to each document in here
# can reference the document using $_
}
@star-crossed
star-crossed / spquicklaunchmodal.js
Last active August 29, 2015 14:26
SharePoint: In Quick Launch, open navigation links under a specific header using a modal dialog
$("a[title='Actions']").next("ul").find("a").each(function (index, element) {
$(element).attr("onclick", "javascript: NewOrEditV4Core(event, '" + $(element).attr("href") + "')");
$(element).attr("href", "#");
});
@star-crossed
star-crossed / sphideinvitepeople.js
Created August 12, 2015 12:58
SharePoint: Hides the Invite People button on the New Folder form
SP.SOD.executeOrDelayUntilScriptLoaded(function() {
var oldDisplayCreateSharedFolderDialog = DisplayCreateSharedFolderDialog;
DisplayCreateSharedFolderDialog = function (rootFolder, webPartID, userSource) {
oldDisplayCreateSharedFolderDialog(rootFolder, webPartID, userSource);
$("#csfd_invitePeopleBtn").hide();
};
}, "createsharedfolderdialog.js");
var Starcrossed = Starcrossed || {};
Starcrossed.PostRenderCallback = function(ctx) {
if (!Starcrossed.fixed) {
$("#WebPart" + ctx.wpq).find("tbody[id^='titl']").each(function(idx, elem) {
// Remove item count
$(elem).find("td").children().last().remove();
// Remove column title
@star-crossed
star-crossed / spuniqueroles.ps1
Last active August 29, 2015 14:27
SharePoint: Test if a list has unique role assignments (PowerShell)
Import-Module Microsoft.Online.SharePoint.Powershell
Function Invoke-LoadMethod() {
param(
[Microsoft.SharePoint.Client.ClientObject]$Object = $(throw "Please provide a Client Object"),
[string]$PropertyName
)
$ctx = $Object.Context
$load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load")
$type = $Object.GetType()
@star-crossed
star-crossed / sproleassignments.ps1
Last active August 29, 2015 14:27
SharePoint: Enumerate RoleAssignments on a Web (PowerShell)
Import-Module Microsoft.Online.SharePoint.Powershell
$password = Read-Host -Prompt "Enter password" -AsSecureString
[Microsoft.SharePoint.Client.ClientContext]$context = New-Object Microsoft.SharePoint.Client.ClientContext("https://jjkllc.sharepoint.com/sites/kma/extranet")
$context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials("pchoquette@jjkllc.com", $password)
$web = $context.Web
$context.Load($web)
$context.Load($web.RoleAssignments)
$context.ExecuteQuery()
@star-crossed
star-crossed / HideNewItemFolder.css
Last active April 4, 2016 19:22
Some CSS to hide the Folder option in New Item menu on SharePoint document library. It also changes the text for the title of the callout menu.
.ms-newdoc-callout-main > hr,
#js-newdocWOPI-divFolder-WPQ2 {
display: none;
}
.js-callout-title {
text-indent: -9999px;
line-height: 0;
}