DiscussionBoard on Sharepoint Online Root SiteCollection

…this post was published on 2014 October 19.

If you will try to add a Discussion Board ​on your Sharepoint Online’root site collection, you will can’t using GUI. As usual, I tried to add it using <<Add App>> from web menu interface. But there are any DiscussionBoard.

I tried also to import a template from another site. The importing procedure was OK but it is missing from the Web Interface <<Add App>>.

So, the resolution could be Powershell Specific Custom Object Model.The code to do it, is this one:
First part is to create the context, the second one is to create the DiscussionBoard list.

Part One
  $loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client”)
     $loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client.Runtime”)
     $User = “SharepointOnlineUseraccount@domain.onmicrosoft.com”
     $weburl=”https://domain-public.sharepoint.com”
     $Context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
     $credentials = Get-Credential
     $Context.Credentials = New-Object   Microsoft.SharePoint.Client.SharePointOnlineCredentials($credentials.Username, $credentials.Password)

Part Two
    $noua_lista = New-Object  Microsoft.SharePoint.Client.ListCreationInformation
    $noua_lista.Title=”Your_DB’s_name”
    $noua_lista.Description=”Description”
    $noua_lista.TemplateType=[Microsoft.SharePoint.Client.ListTemplateType]::DiscussionBoard
    $noua_lista = $context.Web.Lists.add($noua_lista)
    $noua_lista.update()
    $context.Load($noua_lista)
    $context.ExecuteQuery()

For more details about Lists Templates, check this link
http://msdn.microsoft.com/en-us/library/office/microsoft.sharepoint.client.listtemplatetype(v=office.15).aspx

This entry was posted in CSOM, Sharepoint Online. Bookmark the permalink.