Subscribe: SharePoint SharePoint SharePoint

Saturday, February 1, 2014

A list survey discussion board or document library with the specified title already exists error

A few days ago i came up with a strange error while navigating to Site Settings > Title,Logo and Description in a share point site.

The error was :

SharePoint

I did a lot of digging around but was unable to find the relevant issue. The logs were showing errors like "Exception thrown" or "list not found" etc. Then somewhere in the logs i saw this error

"The list "$Resources:core,webpageassetList;" in web "http://mysite/site" was not created"

So it seemed then while enabling the "Wiki Home Page" feature, "Assets Library" was created but somehow lost its context or reference in ContentDB.

So i deleted the current assets library and re-created it. And finally i was able to resolve the navigation issue.

Running ECMAScript under Anonymous access

Client Object Model in SharePoint has been quite significant since its introduction in SharePoint 2010. It does allow us to rapidly build web parts in JSOM/ECMA  with little or no need for compiled code.

The functionality is quite simple and involves creating some functions and executing them asynchronously. This behavior prevents our browser from freezing until the response has come back from the server.

Now we need to take care of some important things while creating web parts using ECMAScript. Since the pages would be accessed  by visitors and may also be accessed by anonymous users, so site admins need to take care of the proper permissions.

Anonymous users , by default,  do not have the privilege of requesting the server for resources even for read only access. One of the example may be like if there is a picture library in the site and a carousel web part on the home page is displaying those pictures . In such cases, while accessing the home page, the anonymous users will get the following error:


It occurs because anonymous users are restricted on requesting the server for "GetItems" property of the list. This behavior is default for anonymous users.


So in order to prevent this error, the site admin must execute the following script in powershell:
 $webapp = Get-SPWebApplication “http://somesite/”
 $webapp.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems") 
 $webapp.Update()

Before doing this make sure "Anonymous Access" is allowed in Web Application:




Thursday, January 30, 2014

Web Part cannot be imported.It's is not registered as safe

While trying to add a custom web part in SharePoint we might come across an error like :

"A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe"

SharePoint 2013



This happens when safe control entries are set to false.

This behavior can be corrected in two ways:

1. Adding safe entries in web.config file :

  a. Open web.config
  b. Locate the SafeControls Tag
  c. Make a safe control entry

    <SafeControl Assembly="Assembly name, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=d8eb6481d8b4beec" Namespace="your webpart namespace" TypeName="*" Safe="True" />

2. Adding safe entries  in SharePointProjectItem.spdata file which can be found in your project    folder: Project Folder-> Module ->spdata file.

 <SafeControl Assembly="Assembly name, Version=1.0.0.0, Culture=neutral,    PublicKeyToken=d8eb6481d8b4beec" Namespace="your webpart namespace" TypeName="*" Safe="True"  />

In some cases the issue is resolved by following any one of them while in other cases both of these methods need to be implemented.