Wednesday, June 11, 2008

Customizing MySite in MOSS and adding report viewer web part

The following two articles are definitely quite valuable information if you want to customize my site under moss/sharepoint 3.0:
https://blogs.msdn.com/sridhara/archive/2007/05/19/customizing-mysite-in-moss-2007.aspx
http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterprise.aspx

Qhile following these instructions and added sql server 2000 report viewer web part, extra problems arose: while we can assign reportmanagerurl and reportpath to the report view web part, assigning string values to toolbarsize property and height/width property won't work. After examining rswebpart.dll file by using 'Reflector', it is clear that the web part won't accept string as input for toolbarsize property, instead it will only accept a typed variable.
Here is the solution(use the second link above as example):
under 'mysitecreatepart' project, add a reference to rswebpart.dll,
and add the following line on the top of partcheck.cs file:
using Microsoft.ReportingServices.SharePoint.UI.WebParts;
inside partcheck.cs's SetWebPartProperties method, add the following code into appropriate position:

// NOTE: Hack to get around the 'ambiguous match' error
// for the Height property.
if (String.Compare("Height",
wpa.Properties.Property[p].Key, true) == 0)
{
xWp.Height = wpa.Properties.Property[p].Value;
continue;
} //end height hack

//hack to setup toolbarsize property
if (String.Compare("ViewerToolbarSize",
wpa.Properties.Property[p].Key, true) == 0)
{
//I only need to get rid of toolbar thus use a static value here... xWp.GetType().GetProperty(wpa.Properties.Property[p].Key).SetValue(xWp,
SPViewer.ToolbarSize.None, null);
continue;
} //end toolbarsize hack

No comments:

Elevating LLM Deployment with FastAPI and React: A Step-By-Step Guide

  In a   previous exploration , I delved into creating a Retrieval-Augmented-Generation (RAG) demo, utilising Google’s gemma model, Hugging ...