SharePoint Dragons

Nikander & Margriet on SharePoint

Monthly Archives: June 2013

Beware of content db creation via SCA UI

If you create a content database via the SCA UI (Application Management > Manage content databases> Add a content database), not only are the Autogrowth settings of your Model DB ignored, SharePoint also ignores the Initial Size of the Model Log files, and instead takes divides the size of your Data file by 4. So, if your data file is 100 GB, the Initial Size of your Log files becomes 25 GB.

Advertisements

Optimizing SQL Server 2012 for SharePoint 2013

Brian Alderman and Bill Baer did a great job on covering how to optimize SQL Server 2012 for SharePoint 2013 at

https://www.microsoftvirtualacademy.com/training-courses/tuning-sql-server-2012-for-sharepoint-2013-jump-start If you want to hear Brian pronounce our Dutch names, skip to the end of the last section :-)!

Third-Party JavaScript

As technical reviewers, we see a lot of books. We feel that Third-party JavaScript is a great book with a horrible title. During review, we’ve commented on the title several times, and suggested to replace it with something like “Enterprise JavaScript”, but the title lasted. This is a sad thing, but don’t judge the book by its title. This is truly a great book that takes writing JavaScript to the next level. We mean, JavaScript is a fun language, and after jQuery we were quite impressed with where you can take this language, but this book has brought our understanding of the language to a whole new level – that is saying something, as we have worked with JavaScript since it’s v1.0 version was released way back when. We’ve even worked with Netscape’s LiveWire (server-side JavaScript aeons before Node.js, btw, why do people love server-side JavaScript, we lived in that world and were quite happy to leave!).

To us, this book is about writing enterprise-level JavaScript code, a topic important in a time where SharePoint devs have to depend upon CSOM so much. It covers:

  • Distributing and loading JS applications
  • Rendering HTML and CSS
  • Communicating with the server
  • Cross-domain IFrame messaging
  • Authentication and sessions
  • Security
  • Developing a 3rd party JS SDK
  • Performance
  • Debugging and Testing

Tool Tip: CloudXPlorer

We have to say, this is a great tool that makes working with Azure easier: http://clumsyleaf.com/products/cloudxplorer

Quick Tip for Testing Load Balancing in SharePoint 2013

Adjust the SharePoint Master page on each WFE and add an HTML comment to it such as: <!—WFE 1 –>, and <!—WFE 2 –>. Yes, we know that’s not supported in production, but if you don’t dare to try minor stuff like that when the situation calls for it, you’re just lacking courage ;-)! We’ve added this tip and more to the Troubleshooting section of the SharePoint 2013 Best Practices page at http://social.technet.microsoft.com/wiki/contents/articles/12438.sharepoint-2013-best-practices.aspx#Troubleshooting

SharePoint 2013 Upgrade and Migration Best Practices

Where are the SharePoint 2013 Search Suggestions?

What to do when search suggestions don’t show up? Run the “prepare query suggestions” timer job!

If you set up search suggestions (as described in http://technet.microsoft.com/en-us/library/jj721441.aspx ) you may notice that no suggestions drop down from the search bar. That makes sense, because they only appear after the “prepare query suggestion” timer job has run. You can force this via PowerShell like this:

Start-SPTimerJob -Identity “prepare query suggestions”

We’ve added the following TechNet Wiki page that describes how to do that: http://social.technet.microsoft.com/wiki/contents/articles/16640.sharepoint-2013-tips-for-troubleshooting-search-suggestions.aspx It will contain any updates to this tip.

Credits

Based on the content of: http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/33265dfd-1316-4c57-92b9-31f0d8f0078c

Add a multivalued taxonomy field to the default view in a custom list thru PowerShell

The title says it all, really. There was one particularly tricky part, where the view needed to be stored in a separate variable, like so:

$view = $myCustomList.DefaultView

Because $myCustomList.DefaultView resulted in the creation of a new View object every time, causing any changes you made to a previous object instance to be lost. The code is here, and it requires you to set up a managed metadata service instance (ours is called Managed Metadata Service), the following blog post can help you with that: http://chakkaradeep.com/index.php/sharepoint-2010-content-type-hubs-publish-and-subscribe-to-content-types/

$TestSiteUrl = “http://demosrv/sites/Wilmie”
$Web = Get-SPWeb -identity $TestSiteUrl

#Dev: remove list and create it every time anew
$List = $Web.Lists[“CustList”]
$List.Delete()

$listTemplate = [Microsoft.SharePoint.SPListTemplateType]::GenericList
$lstId = $Web.Lists.Add(“CustList”,”Cust Descr”,$listTemplate)
write-host “list ” $ListName ” created successfully” $ListName -ForegroundColor Green  

$myCustomList = $Web.Lists[“CustList”]

#Example simple text field (without taxonomy field, this makes testing easier)
#$firstNameColXml = “<Field Type=’Text’ DisplayName=’FirstName’ Required=’TRUE’ MaxLength=’255′ StaticName=’FirstName’ Name=’FirstName’ />”
#$myCustomList.Fields.AddFieldAsXml($firstNameColXml,$true, [Microsoft.SharePoint.SPAddFieldOptions]::AddFieldToDefaultView)  
#$myCustomList.Update()

$taxonomySite = Get-SPSite “http://demosrv:1971″
$taxonomySession = Get-SPTaxonomySession -site $taxonomySite
$termStore = $taxonomySession.TermStores[“Managed Metadata Service”]
write-host “Connection made with term store -“$termStore.Name
$termStoreGroup = $termStore.Groups[“MyTermStoreGroup”];
$termSet = $termStoreGroup.TermSets[“MyTermSet”];

Add-Type -Path ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Taxonomy.dll’
$taxonomyField = [Microsoft.SharePoint.Taxonomy.TaxonomyField] $myCustomList.Fields.CreateNewField(“TaxonomyFieldTypeMulti”, “Location”)
$taxonomyField.Required = $false
$taxonomyField.StaticName = “my_static_name”
$taxonomyField.SspId = $termStore.Id
$taxonomyField.TermSetId = $termSet.Id
$myCustomList.Fields.Add($taxonomyField)
$myCustomList.Update()
Write-Host “Added field ” $taxonomyField.Title ” to list ” $myCustomList.Title -ForegroundColor Green

$field = $myCustomList.Fields[“Location”];
# PLEASE NOTE: It’s important to store the view in a variable, because calling list.DefaultView results in the creation of a NEW view object every time,
# if you do that, new columns will NEVER be added succesfully to the view.
$view = $myCustomList.DefaultView
$view.ViewFields.Add($field)
$view.Update()
$myCustomList.Update()

Write-Host “Added field ” $field.Title ” to default view” -ForegroundColor Green

Write-Host “Finished set metadata”

SharePoint 2010 Best Practices

It’s all about 2013 these days, nevertheless, whenever we see a reason, we’re updating the SharePoint 2010 Best Practices page as well. The Upgrade and Migration section has been updated at http://social.technet.microsoft.com/wiki/contents/articles/8666.sharepoint-2010-best-practices.aspx

Setting default content type column values for a library via PowerShell

Setting default column values for content type columns, the equivalent of [Document Library] > Document Library Settings > Column Default value settings, was surprisingly hard to build in PowerShell. The main gotcha has to do with the fact that you can’t do this via the SPContentType type, instead, you have to do it via the more obscure MetadataDefaults type, located in the Microsoft.Office.DocumentManagement.dll. Here’s the script:

Cls
Write-Host “Initializing SharePoint PowerShell Environment”

$SnapIn = “Microsoft.SharePoint.PowerShell”
if ( get-pssnapin $SnapIn -ea “silentlycontinue”)
{
  Write-Host “Remove SharePoint snap-in” 
  remove-pssnapin $SnapIn
}
if ( get-pssnapin $SnapIn -registered -ea “silentlycontinue”)
{
  Write-Host “Add SharePoint snap-in” 
  add-pssnapin $SnapIn
}

Write-Host “Start Setting default value for content type column”

Add-Type -Path ‘c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.Office.DocumentManagement.dll’
$ProjectWeb = Get-SPWeb -Identity “http://demosrv/sites/Wilmie”
$List = $ProjectWeb.Lists[“1. Project Management”]

$ContentType = $List.ContentTypes[“TestContentType”]

$ColumnDefaults = New-Object -TypeName Microsoft.Office.DocumentManagement.MetadataDefaults $List                 
$ColumnDefaults.SetFieldDefault($List.RootFolder, “TestColumn”, “TestValue from PS”)
$ColumnDefaults.Update()

Write-Host “End setting default value”