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
$site =new-object Microsoft.SharePoint.SPSite("http://intranet") | |
$web = $site.OpenWeb() | |
$list = $web.Lists["Useful Links"] | |
$item = $list.Items.Add() | |
$urlValue = New-Object Microsoft.SharePoint.SPFieldUrlValue() | |
$urlValue.Description = "Link Description"; | |
$urlValue.Url = "http://www.bing.com" | |
$item["URL"] = $urlValue | |
$item.update() | |
$list.update() |
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
public static class LogHelper | |
{ | |
enum LogLevel | |
{ | |
Debug, | |
Info, | |
Warning, | |
Error | |
} |
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
#Load powershell snapin | |
Add-PSSnapin "Microsoft.SharePoint.PowerShell" | |
#Get site collection details | |
$site = Get-SPSite http://mysite | |
#Get all web sites in the site collections | |
$websites = $s.AllWebs | |
foreach($website in $websites) | |
{ | |
Write-Host $website.Title -foreground Yellow |
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
$webApp = Get-SPWebApplication -Identity http://webapplication:8080 | |
$siteCollection =$webApp | Get-SPSite -limit all | |
foreach ($site in $siteCollection) | |
{ | |
$webs = $site | Get-SPweb -limit all | |
foreach ($web in $webs) | |
{ | |
$url = $web.URL | |
write-host "Web URL = " $url -foregroundcolor "blue" |
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
public Dictionary<string,string> Run(string connectionString, string query) | |
{ | |
using (var sqlConnection = new SqlConnection(connectionString)) | |
{ | |
sqlConnection.StatisticsEnabled = true; | |
sqlConnection.Open(); | |
using (var cmd = new SqlCommand(query, sqlConnection)) | |
{ |
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
public class GravatarHelper | |
{ | |
private string CalculateHash(string email) | |
{ | |
MD5 md5Hasher = MD5.Create(); | |
byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(email)); | |
StringBuilder sBuilder = new StringBuilder(); |
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
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> | |
<table style="width: 100%"> | |
<tr valign="top"> | |
<td width="20%"> | |
<SharePoint:SPHierarchyDataSourceControl ID="docLibDataSource" runat="server" RootContextObject="List" ShowFolderChildren="True" EnableViewState="false"></SharePoint:SPHierarchyDataSourceControl> | |
<SharePoint:SPTreeView ID="doclibtreeview" runat="server" DataSourceID="docLibDataSource" EnableViewState="false" ExpandDepth="2" SelectedNodeStyle-CssClass="ms-tvselected"></SharePoint:SPTreeView> | |
</td> |
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
$username = "" | |
$password = "" | |
$Password = ConvertTo-SecureString -String $password -AsPlainText -Force; | |
$Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password | |
Connect-SPOService -Url "https://[tenant]-admin.sharepoint.com" -Credential $Credentials | |
Get-SPODeletedSite | Remove-SPODeletedSite |
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
@echo off | |
@echo Stopping Sharepoint services... | |
@echo Restarting The SharePoint Timer Service... | |
net stop SPTimerV4 | |
net start SPTimerV4 | |
@echo Restarting The SharePoint Administration Service... |
OlderNewer