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
<!-- | |
SharePoint document lock release script | |
Tiago Duarte | |
Based on code from Peter Holpar, | |
https://pholpar.wordpress.com/2014/04/07/how-to-use-javascript-to-delete-short-term-locks-from-documents-opened-from-sharepoint/ | |
Page URL: | |
/Pages/UnlockFile.aspx |
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
SPList list = web.Lists[txtListTitle.Text]; | |
SPListItem item = list.GetItemById(int.Parse(txtItemID.Text)); | |
SPFile file = item.File; | |
if (file.LockType == SPFile.SPLockType.None) | |
{ | |
txtOutput.Text = "File is not locked"; | |
} | |
else | |
{ | |
int lockUserID = file.LockedByUser.ID; |
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
param( | |
$webUrl = "http://demosite", | |
$listTitle = "testlib", | |
$itemID = 183 | |
) | |
clear-host | |
$web = Get-SPWeb $webUrl | |
$list = $web.Lists[$listTitle] |
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
//dlls in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Visual Studio Tools for Office\PIA\Office15 | |
using Microsoft.Office.Interop.Word; | |
using Microsoft.Office.Core; | |
Application wordApp = null; | |
try | |
{ | |
//open a new word process | |
wordApp = new Application(); |
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
<div id="locked-doc"> | |
<p> | |
<label>Document URL</label> | |
<br/> | |
<input id="docUrl" type="text" value="http://" style="width:500px" /> | |
</p> | |
<p> | |
<label>Website URL</label> |
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
#params | |
$username = "admin@contoso.onmicrosoft.com" | |
$password = "myPWD" | |
$url = "https://contoso.sharepoint.com" | |
$adminUrl = "https://contoso-admin.sharepoint.com" | |
$spd = 0#0-deny disabled; 1-deny enabled | |
#connect to SPO | |
$securePassword = ConvertTo-SecureString $password -AsPlainText -force | |
$credential = New-Object System.Management.Automation.PsCredential($username, $securePassword) |
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
//check if page is in edit mode through page form mode | |
if (Microsoft.SharePoint.SPContext.Current.FormContext.FormMode == SPControlMode.Display) | |
{ | |
// your code to support display mode | |
} | |
else if(Microsoft.SharePoint.SPContext.Current.FormContext.FormMode = SPControlMode.Edit) | |
{ | |
// your code to support edit mode | |
} |
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
#[summary goes here] | |
#by [author goes here] @ [date goes here] | |
#[author URL / email] | |
clear-host | |
###################################### FUNCTIONS ############################## | |
#if the context is not administrator, stop the script and start a new shell | |
function EnsureAdmin($invocation) |
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 showRibbonOnCustomizedPages() | |
{ | |
if(window.location.href.contains("/Forms/AllItems.aspx")) | |
{ | |
//console.log("library page"); | |
var listViews = $('.ms-listviewtable'); | |
if(listViews.length === 1) | |
{ | |
//console.log('only one view found'); |
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
<projecttypeguids></projecttypeguids> |
NewerOlder