Archive for the ‘SharePoint’ Category

SharePoint 2013 – Cannot activate Sandbox code solutions

September 4, 2016

We have a couple of sandbox no-code solutions in our Castlepoint product, and on a new SharePoint 2013 farm I could upload them but the Activate button wouldn’t enable.

Then I realised that I hadn’t started the Microsoft SharePoint Foundation Sandboxed Code Service yet… oops! Started the service on my application servers, and then when I tried to Activate the solution the button was enabled immediately.

Problems with SharePoint Designer 2013 and Check In Check Out Actions for Current Item

September 3, 2016

Problem – I want to check out the “Current Item” in my SharePoint Designer 2010 (using SPD2013) workflow, but the “Current Item” property isn’t available to select. I either have a blank list to choose from, or the lists in the root website to choose from. My workflow is associated with a site collection content type.

I had to use the a cached copy for the solution (original article here) so I’m re-printing it here. Following is the text from the original article:

The Requirement:

Create a workflow that will make field updates to a document or page that requires check-in / checkout. This workflow must be able to work on any page or document library in the site collection.

The Solution:

A modification to the .xoml file that tells the workflow to use “this item” regardless of the list.

Disclaimer: If you want to model an out of the box workflow, always copy and modify…it is never a good idea to modify the out of the box global workflows directly.

Steps:

  1. Set up your workflow with placeholders for your check-in and checkout actions.
  2. Add “Check out item in this list” and “Check in item in this list with Comment” actions to the appropriate steps on your workflow.
    1. Do not select a List. Leave the “this list” as is.
  3. Save your workflow.
  4. Go “All Files”, “Workflows”, click on the workflow name in the window below “All files” so that your workflow displays it’s files in the window on the right side of the screen.
  5. Right click on the .xoml file and click “Open With”, “SharePoint Designer (open as XML)”
  6. Save this file.
  7. Click on “Workflows” and click on the workflow name to open the workflow file as you normally would.
  8. Do not make any changes but click “Save”
  9. When Designer pops up to say that a different version of the .xoml file was saved, and politely asks if you want to replace that file with this one click “No”.
  10. Close Designer and re-open it
  11. Click on “Workflows” and click on your workflow to open and edit it.
  12. Find the step where you checked out and checked in the item.
  13. The action should say “Check out item in Current Item” and “Check in item in Current Item with comment: xxx

 

I’m not sure why you have to close Designer and re-open it before you can see your changes, maybe it’s just my wonky machine, but I have to follow these steps exactly on order for the change to “take”.

Notes:

Make sure that you do NOT have “end on change” feature turned on, or your workflow will stop immediately after making the change without checking the document back in.

HOWTO Fix Office Web Apps 2013 Unhealthy Status

June 14, 2016

This issue popped up in a recent deployment of Office Web Apps 2013. The machine status of Unhealthy was being reported when using the following commands on all machines in the farm:

$farm = Get-OfficeWebAppsFarm
$farm.Machines

Looking in the machine event log, the following entries related to OneNote was appearing:

WebOneNoteWatchdoc reported status for OneNoteMerge in category ‘Ping’. There was no endpoint listening at net.pipe://localhost/MergeService that could accept the message.

A quick bit of searching came up with the following:

https://social.technet.microsoft.com/Forums/office/en-US/295d925a-3e48-4f30-8555-3cd3e888d55c/office-web-apps-2013-unhealthy?forum=officeitpro

“Just wanted to re-confirm this was the answer. I had installed Office WA on:
D:\Program Files\Microsoft Office Web Apps\

unknown to me, one component had been created in:
C:\Program Files\Microsoft Office Web Apps\OneNoteMerge

This was generating the
“Exception while executing OneNoteMergeService Ping check” and “Health report by WebOneNoteWatchdog: Agent: OneNoteMerge, eventId: 1141″ in the ULS log files.

Copy OneNoteMerge folder to D drive folder and OWA now healthy (after a short delay). Definitely a bug for our dear friends at Microsoft to sort out.”

This fix worked for me as well – manually copying the OneNoteMerge folder from [C:\Program Files\Microsoft Office Web Apps] to [D:\Program Files\Microsoft Office Web Apps] followed by a reboot fixed my issue!

Changing SharePoint 2013 Site Collection URLs from Host-Named to Path-Based

September 4, 2015

Huge thankyou to Todd Klindt for saving me many many tears.

I have recently installed SharePoint 2013 August 2015 Cumulative Update, and one of the commands available as of the February 2015 Cumulative Update is the [site].Rename() method. This allows you to change the URL of your site from path-based (http://theweb/sites/myweb) to host-named (http://newweb.ishere). It’s a lot better than having to use Backup-SPSite and Restore-SPSite!

We had some databases that had been dismounted from their web application via Dismount-SPContentDatabase. I attached them to their new web application via:

Mount-SPContentDatabase -WebApplication http://the.webapp -Name DB_SiteCollection

This adds the content database to the web application and makes it available. In my case it became the “root” site collection as it was previously attached to a host-header web application (as opposed to a host-named site collection).

I then accessed the site via:

$db = Get-SPContentDatabase DB_SiteCollection $site = $db.Sites[0]

Renaming the site first of all using:

$site.Rename(“http://new-hnsc-url”)

Gave me the following error:

Exception calling “Rename” with “1” argument(s): “Content database does not support renaming to and from host header site collections. Please upgrade content database to version ‘|0’.”

Oops! Forgot to upgrade it! No problem, just using the command:

Upgrade-SPContentDatabase -WebApplication http://the.webapp -Name DB_SiteCollection

Fixed up the version of the content database, then tried my rename command again. This time I got:

Exception calling “Rename” with “1” argument(s): “Cannot rename a site collection with recycled items. Empty the site recycle bin of site collection http://new-hnsc-url and retry.”

OK that makes sense. Recycle bin content would be pointing to different URLs after a site rename. Not sure why recycle bin content can’t be updated at the same time but whatever:

$site.RecycleBin.DeleteAll()

and then the previous $site.Rename() magic worked perfectly. That’s days of work saved thanks to a nice new function.

HOWTO Fix SharePoint 2013 and Workflow Manager Configuration

August 14, 2015

The configuration and integration between SharePoint 2013 and Workflow Manager is hard. Really hard – when it doesn’t work straight away. Workflow Manager is a stand-alone product, integration between SharePoint and WM is all done via PowerShell, diagnosing issues between WM and SharePoint is problematic, and there doesn’t seem to be a concrete method to guarantee it will work. Many articles say “just rebuild your SP farm and/or Workflow farm”. Ouch.

Let’s work backwards to solve the problem. SharePoint Designer 2013 is looking for two configuration items to be completed before it will let you create SharePoint 2013 workflows.

  1. The Workflow service proxy is configured and working (via Central Admin)
  2. The Workflow Service feature is configured and working (via PowerShell)

Both of these components must be enabled and functioning in order to tick the boxes in SharePoint Designer 2013. If either fails, SharePoint Designer will not allow you to create SharePoint 2013 workflows.

The Workflow service proxy (1) connects to the Workflow services system. The Workflow Service feature (2) is a SharePoint feature that must be enabled and configured via SharePoint Powershell for the site collection. Lets got through all the components.

Checking Workflow Manager Service Configuration

Use the following Workflow Powershell commands to view the server configuration:

Get-WFFarm | format-list

This should return the following:

RunAsAccount      : <hostname>
AdminGroup      : <hostname>
HttpPort      :    12290
HttpsPort    :    12291

Endpoints   : <https://my.workflow.url:12290&gt;

You should be able to use your browser to access the Endpoint and return an Xml configuration page.
To get the Farm status use:

Get-WFFarmStatus | format-list

This should return the following:

HostName      : <hostname>
ServiceName   : WorkflowServiceBackend
ServiceStatus : Running

HostName      : <hostname>
ServiceName   : WorkflowServiceFrontEnd
ServiceStatus : Running

The ServiceStatus “Running” is the important part here.

Checking SharePoint 2013 Workflow Service Configuration

Use the following SharePoint 2013 powershell commands to view Workflow Service configuration:

Get-SPWorkflowConfig -SiteCollection [sitecollectionurl]

Get-SPWorkflowServiceApplicationProxy | format-list

Validate that the Endpoints are correct, and you can indeed navigation to them.

Checking SharePoint 2013 Workflow Proxy Application

The workflow proxy application is available through the Central Admin, Manage Service Applications interface. Clicking on the Workflow service application should show you the following:

Workflow - Service Application Proxy Status

Fixing SharePoint 2013 Workflow Service Feature

The following SharePoint Powershell command forces the Workflow Service feature to be enabled:

Enable-SPFeature -Identify WorkflowServiceStore -url <site collection url> -Force

I received this error when I didn’t use the -Force parameter:

Enable-SPFeature: The field with id {GUID} defined in feature {GUID} was found in the current site collection or in a subsite.

SharePoint 2013 CU2 Upgrade Issues with Workflow Manager

During a recent upgrade of our SharePoint farm I noted the following warning in the upgrade log file:

WARNING Error UpgradeWorkflowServiceActivities.  
Run Copy-SPLocalActivitiesToWorkflowService manually to complete this action.  
Error: Microsoft.Workflow.Client.WorkflowEndpointNotFoundException: Unable to connect to the remote 
service at http://<servername>:12291/SharePoint/. See InnerException for more details.

It turned out that during the upgrade the IIS service was offline, so the workflow management endpoint was also offline. There doesn’t actually seem to be a Copy-SPLocalActivitiesToWorkflowService powershell command, but there is a Copy-SPActivitiesToWorkflowService. I ran that command with the following details (i’m using HTTP in my test environment):

$cred=[System.Net.CredentialCache]::DefaultNetworkCredentials
Copy-SPActivitiesToWorkflowService -WorkflowServiceAddress "http://<servername>:12291/SharePoint" -Credential $cred -Force $true

Addendum: Workflow Manager and Service Bus CU2

Service Bus 1.0 Cumulative Update 2 (CU2)

Workflow Manager 1.0 Cumulative Update 2 (CU2)

Shared Properties Not Available for Selection in Document Set Content Type

May 15, 2015

We are using Document Set-based content types to manage documents in our SharePoint 2013 collaboration environment. Document Sets include the ability to use Shared Properties. Shared Properties allow you to pre-set values that will be pushed down to any document within the Document Set, and are great for discovery and automatic settings.

One of our Document Set-based content types wasn’t letting us select all of our site columns as Shared Columns. Even though the Site Columns were added to the content type, they didn’t all appear. Of the 8 site columns added to the content type, only 3 were available for selection as Shared Columns. You can view Shared Columns within any content type based on a Document Set by selecting the Document Set settings link in the Content Type edit screen.

The issue was identified after some Internet sleuthing on the problem. Some of our site columns were set to not display in the Edit form, and this is a requirement to be selectable as a Shared Property.

Background information is here:

http://sharepoint.stackexchange.com/questions/70156/sharepoint-2010-document-set-shared-column-settings-arent-displaying-all-colum

The site column property for us was ShowInEditForm=FALSE. Changing this site column property allowed us to select it as a Shared Property. The following PowerShell commands allow you to set this field.

$web = Get-SpWeb http://my-web-url
$web.Fields["InternalFieldName"].ShowInEditForm = $true
$web.Fields["InternalFieldName"].Update()

After setting this property the field showed up in the Shared Columns list immediately.

Page File impacts on SharePoint 2013

April 29, 2015

We were getting very high numbers of errors on our SharePoint 2013 crawl servers, in the 10,000s in some cases. After contacting Microsoft they advised that our page files weren’t big enough. We had 4GB allocated in static mode, but then changed it to Auto mode. The general rule of thumb is 1.5x RAM

This fixed our search problem.

Reference: http://blogs.msdn.com/b/chaun/archive/2014/07/09/recommendations-for-page-files-on-sharepoint-servers.aspx

HOWTO Get the Search Service Topology Status and Search Health Detail

April 16, 2015

I found this fabulous PowerShell script on GitHub:

https://github.com/chrisdee/Scripts/blob/master/PowerShell/Working/SharePoint/SharePoint2013/SP2013GetSPSearchServiceTopologyState.ps1

It gives a far more detailed status of Search health and will hopefully mean less index resets for me in the future!

HOWTO Check the SharePoint 2013 Crawl Status using SQL Server

April 13, 2015

The Content Sources page in SharePoint 2013 Search Service app displays the current status of crawls on your farm. A lot of my crawls were stuck in the Starting or Completing state and were never marked off as being finished, even after running for over 48 hours on small data sets. I used the following script to find out the exact state of the search components:

SELECT [CrawlID]
 ,[CrawlType]
 ,[ContentSourceID]
 ,[Status]
 ,[SubStatus]
 ,CASE
 WHEN (Status=0 and SubStatus=0) THEN 'New crawl, requesting start'
 WHEN (Status=1 and SubStatus=1) THEN 'Starting, Add Start Address(es)'
 WHEN (Status=1 and SubStatus=2) THEN 'Starting, waiting on Crawl Component(s)'
 WHEN (Status=4 and SubStatus=1) THEN 'Crawling'
 WHEN (Status=4 and SubStatus=2) THEN 'Crawling, Unvisited to Queue'
 WHEN (Status=4 and SubStatus=3) THEN 'Crawling, Delete Unvisited'
 WHEN (Status=4 and SubStatus=4) THEN 'Crawling, Wait for All Databases'
 WHEN (Status=5 and SubStatus=0) THEN 'Failed to Start (eg Another Crawl Already Running)'
 WHEN (Status=7) THEN 'Resuming'
 WHEN (Status=8 and SubStatus=1) THEN 'Pausing, Waiting on crawl component(s) to pause'
 WHEN (Status=8 and SubStatus=2) THEN 'Pausing, complete pause'
 WHEN (Status=9) THEN 'Paused'
 WHEN (Status=11 and SubStatus=0) THEN 'Completed'
 WHEN (Status=12) THEN 'Stopped'
 WHEN (Status=13 and SubStatus=1) THEN 'Stopped, waiting on crawl component(s) to stop'
 WHEN (Status=13 and SubStatus=2) THEN 'Stopping, complete stop'
 WHEN (Status=14 and SubStatus=1) THEN 'Completing, waiting on crawl component(s) to complete'
 WHEN (Status=14 and SubStatus=2) THEN 'Completing'
 WHEN (Status=14 and SubStatus=4) THEN 'Completing, get deletes pending'
 END AS [StatusAsText]
 ,[Request]
 ,[RequestTime]
 ,[StartTime]
 ,[EndTime]
 ,[DeleteUnvisitedStart]
 ,[IsCompleting]
 ,[StartAddressList]
 FROM [MSSCrawlHistory]
ORDER BY StartTime DESC

I was getting “…waiting on crawl” messages against my content sources. One of my crawl servers had the search service hung. Restarting the search service on that server finished off the crawl and reported Completed straight away. Much better!

 

HOWTO Remove the Lock on a SharePoint File

April 10, 2015

A user on one of our SharePoint sites had a file in an Exclusive lock on their laptop, and couldn’t remove the lock. After checking a few sites for how to unlock:

http://sharepoint.stackexchange.com/questions/122067/release-client-side-lock-by-javascript

I cobbled together this PowerShell function based on that. By default it displays the lock status of a file, and if you use the $unlock parameter it will also unlock the file.

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
function SPUnlockFile()
 {
 param(
 [Parameter(Mandatory=$True)][string] $webUrl
 ,[Parameter(Mandatory=$True)][string] $fileUrl
 ,[Parameter()][bool] $unlock = $false
 )
#Get Web and File Objects
 $web = Get-SPWeb $WebURL
 $File = $web.GetFile($FileURL)
#Check if File is Checked-out
 if ($File.CheckOutType -ne "None")
 {
 Write-host "File is Checked Out to user: " $File.CheckedOutByUser.LoginName
 Write-host "Checked Out Type: " $File.CheckOutType
 Write-host "Checked Out On: " $File.CheckedOutDate
#To Release from Checkout, Ask the checked out user to Checkin
 #$File.Checkin("Checked in by Administrator")
 #Write-host "File has been Checked-In"
 }
#Check if File is locked
 if ($File.LockId -ne $null)
 {
 Write-host "File is Locked by:" $File.LockedByUser.LoginName
 Write-host "File Lock Type: "$file.LockType
 Write-host "File Locked On: "$file.LockedDate
 Write-host "File Lock Expires on: "$file.LockExpires
 Write-host "File Lock Id: "$file.LockId
if ($unlock)
 {
 Write-Host "Releasing lock..."
 $userId = $file.LockedByUser.ID
 $user = $web.AllUsers.GetByID($userId)
$impSite= New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken); $impWeb = $impSite.OpenWeb(); $impFile = $impweb.GetFile($FileURL)
 $impFile.ReleaseLock($impFile.LockId)
}
 }
 else
 {
 Write-Host "File is unlocked" -foregroundcolor Green
 }
}
#USAGE
 #SPUnlockFile -weburl "http://weburl" -fileUrl "http://fullpathtofileurl"
 -unlock $false