Skip to main content

Deploy customized promoted link list

I needed to create a custom list based on the promoted link list. When I tried to add the list using Visual Studio I could not find a way to create a list template based on promoted links. I could only create list instances based on promoted links. That would have been ok if I did not need to add my own fields. Since I am using sand box solution and trying to make it non-code, I would have to find a declarative method to do this.

I then tried to find the content type that promoted link is based on, but to my surprise, it is based a hidden content type called “System”. All the fields are defined in the list content type. Therefore, I could not create a custom content type based on any site content types.

Then I got the idea of setting it up in a temporary team site and then export it as a template. Doing this would make so I could see how the exported WSP handled the promoted list. After importing the WSP into Visual Studio I was able to get a List Template for setting up the promoted links list.

Here are the result of doing this:

First, I setup a temporary team site, then added a promoted link list, then and called it “Promoted List item”.

I exported the site by storing it as a template, and downloaded the template WSP file.

When I Imported the WSP in visual studio I just selecting the list, Visual Studio will find the dependencies and ask you to include them after clicking “finish”.



The imported WSP project looked like this: 


Then I copied the list template files form the import Visual studio project in the project in my solution, and included in the project. 



I left out the field definitions and the property bag entries thinking that the “Team collaboration lists” feature includes that. and was left with only the list template.


Now I could add the custom fields.





Then making sure my feature was dependent on the "Team collaboration lists" feature. And I was god to go. 

Comments

Popular posts from this blog

Getting the script folder in PowerShell

Today I needed to call another script file in the same folder as the main script. After a little searching on the web I found "$MyInvocation.MyCommand.Path". "$MyInvocation.MyCommand.Path" returns the path to the current script, With that I was able to get the current folder using Get-Item. This is my test scripts: ToRun.ps1: Write-Host $MyInvocation.MyCommand.Path $scriptDirectory  = (Get-Item $MyInvocation.MyCommand.Path).DirectoryName $scriptName = "HelloWorld.ps1" Write-Host calling $scriptName in $scriptDirectory & ($scriptDirectory + '\' + $scriptName) HelloWorld.ps1: Write-Host "Hello word" After running the script the output was: calling HelloWorld.ps1 in C:\scriptFun Hello word Simple but useful.

Using azure event gird with a function app

Introduction In this tutorial we will set up a simple azure event grid topic, with an function app as a subscriber to the topic. The function app will just log the messages, so we can se that it picked up the event. Setting things up First step is to create a resource group where we can add all the azure services we need az group create --name  myresourcegroup   --location norwayeast We need to set up a storage account that can be used bye the function app. az storage account create --name mystorageaccount --resource-group myresourcegroup --location eastus --sku Standard_LRS Now that we have a storage account we can make the function app. Here we will set it up to be able to run .Net 6 functions az functionapp create --name myFunctionApp --resource-group  myresourcegroup  --consumption-plan-location eastus --runtime dotnet --runtime-version 6.0 --functions-version 4 --storage-account  mystorageaccount...