Skip to content

Instantly share code, notes, and snippets.

View MaxMelcher's full-sized avatar
🏠
Working from home

Max Melcher MaxMelcher

🏠
Working from home
View GitHub Profile
@MaxMelcher
MaxMelcher / Deploy.bat
Last active December 20, 2015 02:59
SharePoint Solution Deployer with Powershell version 2 but installed is version 3 (SP2010 does not like that)
GOTO LAUNCHSCRIPT
:LAUNCHSCRIPT
"%SYSTEMROOT%\system32\windowspowershell\v1.0\powershell.exe -Version 2 -NoExit" -Command Start-Process "$PSHOME\powershell.exe -Version 2 -NoExit" -Verb RunAs -ArgumentList "'%~dp0\Scripts\SPSD_Main.ps1 -Command %command% -Type %type% -Verbosity %verbosity% %saveEnvXml%'"
ENDLOCAL
Add-PSSnapin microsoft.sharepoint.powershell -ea 0
$ssa = Get-SPEnterpriseSearchServiceApplication | Where-Object {$_.Name -eq "Search Service Application"}
$id = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $ssa | ? { $_.Name -eq "Local SharePoint Sites"}
$log = New-Object Microsoft.Office.Server.Search.Administration.CrawlLog $ssa
Write-Host "Success:"
$dt = $log.GetCrawledUrls($false, 10000, $null, $false, $id.Id, 0, -1, [System.DateTime]::MinValue, [System.DateTime]::MaxValue)
@MaxMelcher
MaxMelcher / Program.cs
Last active August 29, 2015 14:10
Redemption new email event
class Program
{
static void Main(string[] args)
{
MailNotifier mailNotifier = new MailNotifier();
mailNotifier.Start();
var t = Task.Factory.StartNew(() =>
{
while (Console.ReadKey().Key != ConsoleKey.Q)
A database error occurred. Source: Microsoft SQL Server Native Client 10.0 Code: 2601 occurred 1 time(s)
Description: Cannot insert duplicate key row in object 'dbo.MSSCrawlChangedSourceDocs' with unique index 'IX_MssCrawlChangedSourceDocs'. The duplicate key value is (434, 1).
using (var ctx = new ClientContext("https://intranet.demo.com/sites/test"))
{
var web = ctx.Web;
var list = web.Lists.GetByTitle("Documents");
ListItemCreationInformation lici = new ListItemCreationInformation
{
UnderlyingObjectType = FileSystemObjectType.Folder,
LeafName = "TEST-CSOM"
};
var item = list.AddItem(lici);
http://hotfixv4.microsoft.com/Windows 7/Windows Server2008 R2 SP1/sp2/Fix354919/7600/free/425407_intl_x64_zip.exe
<#
.TERMS
Refer to Microsoft Connect Terms of use http://connect.microsoft.com/terms.aspx#O
.SYNOPSIS
This script onboards your SharePoint Online (SPO) tenant into the cloud hybrid search SharePoint Server 2013 Preview/SharePoint 2016 Preview
.PARAMETER PortalUrl
SharePoint Online portal URL, for example 'https://contoso.sharepoint.com'.
.PARAMETER HybridSsaId
Name or id (Guid) of the cloud hybrid search application, created with the CreateCloudSSA script.
.PARAMETER Credential
<#
.TERMS
No terms - use on your own risk!
.SYNOPSIS
This script efficiently emtpties are large list and is approximately 30 times faster than deleting item by item.
You need to have the SharePoint Online SDK (https://www.microsoft.com/en-us/download/details.aspx?id=42038) installed to run this script.
.PARAMETER weburl
SharePoint Online web URL, for example 'https://contoso.sharepoint.com'.
.PARAMETER listname

Keybase proof

I hereby claim:

  • I am maxmelcher on github.
  • I am maxmelcher (https://keybase.io/maxmelcher) on keybase.
  • I have a public key ASCgacYQpljLL6v7oEAepeDRniywArNynL4EoMHsn3C51Qo

To claim this, I am signing this object:

#use this task to execute inline powershell in your build https://marketplace.visualstudio.com/items?itemName=petergroenewegen.PeterGroenewegen-Xpirit-Vsts-Build-InlinePowershell
#add the script below
#pass the following as arguments: -buildnumber $(Build.BuildNumber) -out $(Build.ArtifactStagingDirectory)\out.txt -guid $(System.TeamProjectId)
#replace the two placeholders with a Personal Access Token and your VS Account name; the part behind https://dev.azure.com/
Param(
[string]$buildnumber,
[string]$out,
[string]$guid
)