Showing posts from May, 2013

Deal easily with Safe Controls problems in SharePoint with Visual Studio 2010

You get the following error when you try to add a custom WebPart in to your site:

"Type is not registered as safe"

This means that you:

Don't have an web.config entry for your dllhave a wrong web.config entry for your dll
The 2nd reason is more often, especially when you develop a WebPart in Visual Studio and change the default Class or NameSpace names.

Steps to solve the problem 1. Check your web.config This step is only to check if there is a web.config entry when you deploy your solution. For this deploy your solution into the farm. Open your web.config file in (C:\inetpub\wwwroot\wss\VirtualDirectories\youwebapp\web.config).
Search after "<SafeControls>" and check if your dll is listed there and if so check if all parameters like PublicKeyToken, NameSpace or DLLName are correct

Tip: If oyu deployed your assembly into the GAC, you can check the "PublicKeyToken" in your GAC. Just press "Win + R" key and enter "assembly". Sea…

Different list views for folders, content types and files in SharePoint 2010

There is a not well known feature of SharePoint I want to show. You can create different default list views for different content types.

As an example you have a top folder for specific orders which is automatically created by your customer when he orders something. Within this folder you and your customer exchange documents.

You goal is that when someone enters the order list he only sees his folder.

1. Attempt My first opinion would be to create a list view with a specific filter. But here begins the problem: How should the filter look like ? If you set "Created By = [Me]" the customer will only see documents and folders he created. When you use "Created By = [Me] & Contenttype = Folder" he would not see subfolders created by others.

2. Attempt The more elegant way is to use different content types for top folders and subfolders. Based on the content types you can create different default views.

2.1 Create Content Types So create a new content type based on …