Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)..
Resolution:
Resolution:
Investigating the method, SetDocumentIconUrlAndOnClickString using reflector, I found this line of code which would result in this exception for anonymous users:
builder.Append(StrJScriptParameter(Convert.ToString(web.CurrentUser.ID, CultureInfo.InvariantCulture), true));
When I was about to override this behavior by code, I found a more elegant non-code solution on the web. The solution was to export the web part and add the following to the commonviewfields property:
<property name="CommonViewFields" type="string">DocumentIconImageUrl;OnClickForWebRendering</property>
This solved the problem.
No comments:
Post a Comment