Tuesday, May 18, 2010

Removing the export menu items of the report view webpart in sharepoint Integration mode

Open the configuration file "rsreportserver.config" located at "C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\rsreportserver.config". The config file is an Xml file which acts as the configuration for the current report services installation. From the nodes locate the sub node element named . Xml file with report data - <Extension Name="XML" Type="Microsoft.ReportingServices.Rendering.XmlDataRenderer.XmlDataReport,Microsoft.ReportingServices.XmlRendering"/> CSV (Comma delimited) - <Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering"/> TIFF file - <Extension Name="IMAGE" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageReport,Microsoft.ReportingServices.ImageRendering"/> Acrobat (PDF) file - <Extension Name="PDF" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport,Microsoft.ReportingServices.ImageRendering"/> Web archive - <Extension Name="MHTML" Type="Microsoft.ReportingServices.Rendering.HtmlRenderer.MHtmlRenderingExtension,Microsoft.ReportingServices.HtmlRendering"/> Excel - <Extension Name="EXCEL" Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering"/> Just add the attribute Visible="false" to the Extension element which has to be hidden in the Export option, say you want to hide Xml then < Name="XML" Type="Microsoft.ReportingServices.Rendering.XmlDataRenderer.XmlDataReport,Microsoft.ReportingServices.XmlRendering" Visible="false"/> Go back to the webpart page and then do a page refresh and you will find that the export option is not rendered. P.S. Please make sure that you don't do the comment out or remove the Extension node unless you are sure that type of rendering will not be required, else it will shown an rendering error.

Thursday, May 6, 2010

Trick to easily go to web part maintenance page

Its by adding a query string ?contents=0, at the end of the current url and press enter or click on GO. Cheers !!

Saturday, September 12, 2009

Sharepoint WebService Deployment Routine

Follow the steps for deploying ASP.Net Webservices to Sharepoint environment.
1. Run the ASP.Net Webservice from Visual Studio (Hit F5).
2. Copy the URL from the browser.
3. Open Visual Studio Command Prompt.
4. Go any Folder using DOS Command
5. Type the Command DISCO http://servername:portnumber/WebServiceName.asmx ( URL Copied in Step 2)
6. This will generate the discovery (.disco) file and the WebService Definition (.wsdl) file to the Current Folder.
7. Rename the .disco and .wsdl to WebServiceNameDisco.aspx and WebServiceNameWsdl.aspx
8. Replace the header of the (files mentioned in Step 7) .aspx files to use ASPX page header tags
<%@ Page Language="C#" Inherits="System.Web.UI.Page" %> <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
9. Replace the webservice url references inside the file to use Server tag which builds the Dynamic WebUrl at request time.
Remove the localhost link to the wsdl and asmx uri with
<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request) + "?wsdl"),Response.Output); %> for wsdl
and <% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> respectively
10. Open the .asmx file in some text editing tool (notepad for eg.) and replace the CodeBehind to use the Respective class and the Dll name space.
<%@ WebService Language="C#" Class="NameSpace.ClassName, NameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=dllkeytoken" %>
where NameSpace is your dll namespace, ClassName is the WebService class name and dllkeytoken is the public ket token of dll. 11. Copy WebServiceName.asmx, WebServiceNameDisco.aspx and WebServiceNameWsdl.aspx to ISAPI Folder in the 12 Hive.
12. Test the WebService Request by typing the WebService Request as follows, http://sharepointurl/_vti_bin/WebServiceName.asmx.

Note: The WebService can be debugged in Visual Studio (if dll Deployed is in Debug Mode) by attaching it to the w3wp.exe process.

Monday, August 24, 2009

Setting up Sharepoint Server Search to index pdf content and to show PDF Icon

  1. Decide the image to be shown for the pdf doc icon and copy it to 12\TEMPLATE\IMAGES (Normally icpdf.gif file)
  2. Open DOCICON.XML which is located in folder 12\TEMPLATE\XML
    1. Under the node <byextension> add the below statement.
      1. <mapping key="pdf" value="imageFileName.gif">
      2. imageFileName.gif is the name of the gif file copied above
      3. Save the XML file.
  3. Go to Sharepoint Central Admin -> Shared Services
    1. Click on file types
      1. Click on the new file type to add the pdf file type. Click ok to add it to the list. And verify that the file extension is populated.
  4. Stop the IIS
  5. Install the Adobe IFilter which can be downloaded from internet (ifilter60.exe).
  6. After successful installation of Abode IFilter restart IIS.
  7. Reset Crawled content (SharedServices -> Search Settings) this is required since it may not re-crawl the older sites even in Full Crawl.
  8. Now need to add the Name column to do this follow the steps
    1. Go to Search Settings -> Metadata property mappings
    2. Add a new Mapped Property for FileLeafRef. Click on the Add Mapping, in the seach text box enter keyword fileleafref and click on find to filter the Select Crawled property to ows_FileLeafRef(Text). Click on ows_FileLeafRef(Text) in the list box to select it and Click OK. Enter the propery name as “Name”
    3. Click Ok to Save it.
    4. Make sure that the newly added property is populated in the list
  9. After Resetting go to Content Sources and Crawl Schedules
  10. Apply a Full Crawl
  11. Wait for the crawl to complete.
  12. Once the crawl is completed the pdf document matching the search criteria will be shown in search results.

Wednesday, August 12, 2009

Using Excel Service hosted using Sharepoint in .Net Application (C#)

An Excel Sheet is created to do a calculation of ADD.
Cell$G$155 is set to function SUM of the values on Cell$G$145 and Cell$G$150 (Instead of the Cell and Row No, the Defined a Name to the Cell and that can be used)
The Above excel is published to an Excel enabled Sharepoint Library.
The above library url has to be set as trusted Url in the Sharepoint Central Admin Excel Services Settings.
Below is how that published excel can be used for calculation from another application (webpart, Console or anyother .Net Application) using C#.
Add the Web Service Reference of the ExcelService first to the application.

ExcelService oExcelServ = new ExcelService();
oExcelServ.Url = SPContext.Current.Web.Url + "/_vti_bin/ExcelService.asmx";
oExcelServ.Credentials = System.Net.CredentialCache.DefaultCredentials;

Status[] Status = null;
String SessionID = null;
string pathWorkBook = @"http://servername/LibraryName/excelFile.xlsx";
SessionID = oExcelServ.OpenWorkbook(pathWorkBook, "en-US", "en-US", out Status);
int val1, val2;

//EXCELSHEETNAME à The Name of the Sheet in the .xlsx file which is published.
//EXCELSHEETNAME!$G$145 à SheetName!$CellAlphabet$RowNo
Status = oExcelServ.SetCellA1(SessionID, "EXCELSHEETNAME", "EXCELSHEETNAME!$G$145", val1);
Status = oExcelServ.SetCellA1(SessionID, "EXCELSHEETNAME", "EXCELSHEETNAME!$G$150", val2);

//Execute the CalculateWorkbook function to trigger Calculation
Status = oExcelServ.CalculateWorkbook(SessionID, CalculateType.CalculateFull);
object result = null;

// Read the result back from the Cell.
result = oExcelServ.GetCellA1(SessionID, "EXCELSHEETNAME", "EXCELSHEETNAME!$G$155", true, out Status);