Tuesday, April 21, 2015

SSRS - “The item '.rdl' cannot be found. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ItemNotFoundException: The item '.rsds' cannot be found” in multi server SharePoint farm

I came across above exception when modifying the data source of SSRS reports using reporting services SOAP web service. Following is the detailed exception I received.

“System.ApplicationException: Failure in ActivateFeature for feature “<Feature>” on site: “<Site>” ---> System.Web.Services.Protocols.SoapException: The item 'http://sp13/Reports/TestReport.rdl' cannot be found. ---> Microsoft.ReportingServices.Diagnostics.Utilities.ItemNotFoundException: The item 'http://sp13/Reports/TestReport.rdl' ' cannot be found.   
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)”

To resolve the issue I had to follow the steps given below

1. Check if you have installed SSRS Service and Proxy in all SharePoint Servers   

I found out above services were installed only in my application server. So I had to configure it in all WFE servers

  1. Install-SPRSService
  2. Install-SPRSServiceProxy

2. Recreate the SSRS Service application

above actions solved my issue :)

Thursday, April 9, 2015

SSRS - System.Web.Services.Protocols.SoapException: The permissions granted to user 'NT AUTHORITY\ANONYMOUS LOGON' are insufficient for performing this operation. when using ReportingServices2010.asmx in web applications with multiple authentication providers

I came across above exception when accessing SSRS reports using reporting services SOAP web service. Following is the detailed exception I received.

“System.ApplicationException: Failure in ActivateFeature for feature "<Feature>" on site: '<Site>' ---> System.Web.Services.Protocols.SoapException: The permissions granted to user 'NT AUTHORITY\ANONYMOUS LOGON' are insufficient for performing this operation. ---> Microsoft.ReportingServices.Diagnostics.Utilities.AccessDeniedException: The permissions granted to user 'NT AUTHORITY\ANONYMOUS LOGON' are insufficient for performing this operation.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.SqlServer.ReportingServices2010.ReportingService2010.CreateCatalogItem(String ItemType, String Name, String Parent, Boolean Overwrite, Byte[] Definition, Property[] Properties,”

To resolve the issue I had to include following code segment when calling the web service

  1. ReportingService2010 service = new ReportingService2010();
  2. service.Credentials = CredentialCache.DefaultCredentials;
  3. service.Url = "http://sp13/_vti_bin/ReportServer/ReportService2010.asmx";
  4.  
  5. var authCookie = HttpContext.Current.Request.Cookies["FedAuth"];
  6. if (authCookie != null)
  7. {
  8.   var fedAuth = new Cookie(authCookie.Name, authCookie.Value, authCookie.Path, string.IsNullOrEmpty(authCookie.Domain) ? HttpContext.Current.Request.Url.Host : authCookie.Domain);
  9.   service.CookieContainer = new CookieContainer();
  10.   service.CookieContainer.Add(fedAuth);
  11. }

Friday, April 3, 2015

Deploy Advanced Search Box web part to SharePoint 2013 using module

We use Advanced Search Box to refine our search using keywords, managed properties and result types.This is very useful tool when the SharePoint environment contains a large amount of data.

image

There can be situations where you need to add this web part to custom web part pages programmatically. This task was very easy in SharePoint 2010 environments as this web part (AdvancedSearchBox.dwp) is available in web part gallery. Unfortunately this web part is no longer available in web part gallery in SharePoint 2013.

In this article I’ll show how to make that web part available in web part gallery so you can add it to pages later. Following are the steps I used to deploy the web part to the gallery

1. Navigate to the search center and execute sample query to get Advanced Search option

image

2. Edit the Advanced Search page and edit web part properties if required

image

3. After customizing properties, export the web part

image

4. Navigate to your visual studio solution and add a new Module. Include exported web part in that module

image

5. Modify Elements.xml as below

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  3.   <Module Name="WebParts" Url="_catalogs/wp" RootWebOnly="TRUE">
  4.     <File Path="WebParts\AdvancedSearchBox.dwp" Url="AdvancedSearchBox.dwp" Type="GhostableInLibrary">
  5.       <Property Name="Group" Value="Default Web Parts"></Property>
  6.     </File>
  7.   </Module>
  8. </Elements>

6. Deploy and activate the feature. Now the web part should be available in web part gallery

image

After the web part is deployed to the gallery we can easily add it to pages programmatically by using current page’s Limited Web Part Manager (SPWeb.GetLimitedWebPartManager)