Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

March 2017

Download all Documents in a Library View

The PowerShell below will download all documents in a given SharePoint Document Library view to the local folder.   This can be safely run on end user Windows PC and does not require SharePoint server access or object model.    The design relies solely upon HTTP to discover the list of Document URLs then HTTP to download the binary content.    Simple and straight forward. 

Just edit the URL and GUID number on the first 3 lines and you’re ready to run.   Alternatively, you can supply those values via CMD parameter like this:

.\SPDownloadView.ps1 -url "http://portal/sites/test" -listID "41E5FC8E-D174-4F48-AC3C-79F999A045D1" -viewID "5E9415B3-3C63-48AD-9DC2-A5A282B61790"

Enjoy!

shades_smile

Source Code

# Download all files from a SharePoint Document Library view to the local folder over HTTP remotely.  
# No server side requirement, can run anywhere, including end user desktops.
param (
    $url,       # "http://portal/sites/test",
    $listID,    # "41E5FC8E-D174-4F48-AC3C-79F999A045D1",
    $viewID     # "5E9415B3-3C63-48AD-9DC2-A5A282B61790"
    )
# Current folder
$scriptpath = Split-Path $MyInvocation.MyCommand.Path
	
# Open file list
Write-Host "Opening $url"
$ows = "$url/_vti_bin/owssvr.dll?Cmd=Display&List={$listID}&View={$viewID}&XMLDATA=TRUE"
$owsList = "$url/_vti_bin/owssvr.dll?Cmd=ExportList&List={$listID}&XMLDATA=TRUE"
$r = Invoke-WebRequest $ows -UseDefaultCredentials
$rList = Invoke-WebRequest $owsList -UseDefaultCredentials
$xml = $r.Content
$xmlList = $rList.Content
$folder = $xmlList.List.Url
# Client
$client = New-Object System.Net.WebClient
$client.UseDefaultCredentials = $true
# Loop and download
foreach ($row in $xml.xml.data.row) {
    $name = $row.ows_LinkFilename
    $from = "$url/$folder/$name"
    $client.DownloadFile($from, "$scriptpath\$name")
}
Write-Host "DONE"

 

Video

 

References

Custom Web Part – Save settings to SPList (without jQuery)

Ever wanted to code a JavaScript content editor (script editor) web part that saves settings to a list?   Without jQuery?

The library below “wp-settings.js” does exactly that with native XHR (XML HTTP Request) and nested callback to invoke REST API.   The free standing POJO (Plan Old JavaScript Object) design enables us to package into a web part gallery and use freely across any site without preparation work to ensure jQuery, Angular, or other dependent frameworks are loaded.

Look at the “webpart.html” to see example usage pattern:

  • wpsRead()  Get settings (if any)
  • wpInit()  Local web part initialize
  • wpsWrite()  Save settings (UPDATE/INSERT)

 

Cheers! 

shades_smile

 

 

Source Code

 

Video

 

Screenshots

image
image
image

 

References

FIXED – Microsoft.Service Bus error 102

While troubleshooting a Workflow 2013 Farm outage I noticed the below event log errors.   The fix was to execute Workflow 2013 PowerShell cmdlets to “sync” the binary front end with SQL database backend.   Similar to how SharePoint Config Wizard does this after CU EXE installation with SharePoint Farms, we may need to run similar “SPFarmUprgade” steps for Workflow 2013 Farms.

Cheers! 

shades_smile

 

Resolution

# Update Service Bus Farm Database
$mycert = ConvertTo-SecureString -string "workflow-farm-password-here" -Force –AsPlainText
$mypassword = ConvertTo-SecureString -string "workflow-farm-password-here" -Force –AsPlainText
$sbfarm = Get-SBFarm
Remove-SBHost
Invoke-SBFarmUpgrade -SBFarmDBConnectionString $sbfarm.SBFarmDBConnectionString -CertificateAutoGenerationkey $mycert
Add-SBHost -SBFarmDBConnectionString $sbfarm.SBFarmDBConnectionString -RunAsPassword $mypassword -EnableFirewallRules $false -CertificateAutoGenerationKey $mycert

 

Symptom

Microsoft.ServiceBus – 102

The description for Event ID 102 from source Microsoft.ServiceBus cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
An unrecoverable error occurred. For diagnostic purposes, this English message is associated with the failure: ‘Messaging Host Aborted’.
   at Microsoft.ServiceBus.Common.ExceptionTrace.TraceFailFast(String message, EventLogger logger)
   at Microsoft.ServiceBus.Common.ExceptionTrace.TraceFailFast(String message)
   at Microsoft.ServiceBus.Common.Fx.AssertAndFailFastService(String description)
   at Microsoft.Cloud.ServiceBus.MessageContainerHost.MessageContainerHostComponent.Abort()
   at Microsoft.Cloud.HostingModel.ComponentHost.CloseComponent(IComponent component, RequestTracker tracker)
   at Microsoft.Cloud.HostingModel.ComponentHost.Close()
   at Microsoft.ServiceBus.MessageBroker.Backend.OnStart(String[] args)
   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
Microsoft.ServiceBus.MessageBroker
24680

 

Application Error – 1000

Faulting application name: Microsoft.ServiceBus.MessageBroker.exe, version: 2.0.30904.0, time stamp: 0x5227aa71
Faulting module name: KERNELBASE.dll, version: 6.2.9200.21815, time stamp: 0x56eafa38
Exception code: 0xe0434352
Fault offset: 0x0000000000024650
Faulting process id: 0x2d9c
Faulting application start time: 0x01d29d7381132061
Faulting application path: C:\Program Files\Service Bus\1.1\Microsoft.ServiceBus.MessageBroker.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: bfa8f2cc-0966-11e7-9482-0050569927e2
Faulting package full name:
Faulting package-relative application ID:

 

2017-03-16_11-11-19

References

What’s in that patch? March 2017

NOTE – PDF format updated to include both SharePoint 2013 and 2016 notes.

 

Ever wondered what fixes are inside of a given CU?   Please see attached PDF with full detail. I wanted a new format for easy reading.   Show management and make the business case for why downtime should be taken to apply CUs.  Also posted at http://sharepointupdates.com/

If you found this helpful, please leave a comment.   

shades_smile_thumb_thumb_thumb_thumb[2]

 

Download

What’s in that patch – Mar 2017.PDF

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲