SharePoint 2010 Developer Dashboard

Developer Dashboard is one of the hidden features in SharePoint 2010. It is turned off by default.

Enabling this feature will help you get critical information such as Execution time, log ID, critical events, database queries, service calls, SPRequest allocation and webpart events.

Developer Dashboard Modes:

‘On’ Mode:
STSADM:
stsadm -o setproperty -pn developer-dashboard -pv on
Powershell:
$sp2010 = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$sp2010.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On;
$sp2010.RequiredPermissions = 'EmptyMask';
$sp2010.TraceEnabled = $true;
$sp2010.Update();

When in this mode, it stays on be default:

‘On Demand’ Mode:
STSADM:
stsadm -o setproperty -pn developer-dashboard -pv ondemand
Powershell:
$sp2010 = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$sp2010.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::OnDemand;
$sp2010.RequiredPermissions = 'EmptyMask';
$sp2010.TraceEnabled = $true;
$sp2010.Update();

You will have to click the icon for the developer dashboard to show:

Disable Developer Dashboard:
STSADM:
stsadm -o setproperty -pn developer-dashboard -pv off
Powershell:
$sp2010 = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$sp2010.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::Off;
$sp2010.Update();

Dashboard not shown or enabled.

Failures in SharePoint

Generating/Rendering a PDF from a sql reporting services report - CRM 4

sounds simple dosen’t it - my objective is to run an estimate report and render to PDF all from the click of a button as shown in the screenshot below:

Heres the code – 

string oppID = Request.QueryString["oppID"].ToString();
ReportingService rs = new ReportingService();
rs.Url = "http://server/reportserver/ReportService.asmx";
System.Net.NetworkCredential creds = new System.Net.NetworkCredential();
creds.Domain = "domain";
creds.UserName = "username";
creds.Password = "password";
rs.Credentials = creds;
byte[] result = null;
string reportPath = "/CRMORG_MSCRM/4.0/{c6352760-a801-e011-9a31-005056ad3d4b}";
string format = "PDF";
string historyID = null;
string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
string showHideToggle = null;
string encoding;
string mimeType;
string extension;
ParameterValue[] parameterUsed;
string[] streamIds;
Warning[] warnings = null;
ParameterValue[] parameters = new ParameterValue[1];
parameters[0] = new ParameterValue();
parameters[0].Name = "OpportunityID"; // parameter name
parameters[0].Value = "{C7DF8F1C-8DF6-DF11-9A31-005056AD3D4B}";
DataSourceCredentials dsc = new DataSourceCredentials();
dsc.DataSourceName = "DataSource1";
dsc.UserName = "C9444B29-E6FC-DF11-9A31-005056AD3D4B"; // SystemuserId from the filteredUser table
dsc.Password = "D945754F-C1DF-DF11-81ED-005056AD3D4B"; // OrganizationId from the filteredUser table
DataSourceCredentials[] credentials = new DataSourceCredentials[] { dsc };
result = rs.Render(reportPath, format, historyID, devInfo, parameters, credentials, showHideToggle, out encoding, out mimeType, out parameterUsed, out warnings, out streamIds);
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=" + Request.QueryString["oppID"].ToString() + ".pdf");
Response.BufferOutput = true;
Response.BinaryWrite(result);
Response.End();
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.Flush();
 Response.Close();

Deploy aspx to CRM ISV folder — create ISV button to call the ASPX page passing the oppID parameter (being the actual opportunityid) to the page.

This report requires a default or user-defined value for the report parameter ‘Parameter’. To run or subsribe to this report, you must provide a parameter value

ahhh sql reports — i mean come on this sounds like a simple parameter problem — however what seems to be the problem here is that in the report i was requesting from sql srs web services for CRM4 — you must define data source credentials with the datasource name being the datasource name on the report!!

then you get this error:

An error has occured during report processing — > Cannot create a connection to data source ‘DataSource1′ — > Guid should contain 32 digits with 4 dashes…

i’m kicking myself at this point saying WTF!!

This error occurs because the Microsoft Dynamics CRM Data Connector for Microsoft SQL Server Reporting Services requires the user’s SystemUserId value as the Log in name and the user’s OrganizationId value as the password (for the datasource credentials)..

When a report runs inside Microsoft Dynamics CRM, these values are passed automatically. These values must be entered manually when the report is run directly from SQL Server Reporting Services.

DataSourceCredentials dsc = new DataSourceCredentials();
dsc.DataSourceName = "DataSource1";
dsc.UserName = "C9444B29-E6FC-DF11-9A31-005056AD3D4B"; // SystemuserId from the filteredUser table
dsc.Password = "D945754F-C1DF-DF11-81ED-005056AD3D4B"; // OrganizationId from the filteredUser table
DataSourceCredentials[] credentials = new DataSourceCredentials[] { dsc };

more info at: http://support.microsoft.com/kb/2006869

Server did not recognize value of HTTP Header SOAPAction http://schemas.microsoft.com/sqlserver/2003/12/reporting/reportingservices/Render

You will get this error with SQLSRS if you are using the ReportExection URL with webservices.

the correct URL is: http:///reportserver/ReportService.asmx

SRS 2005: Add a Page No to each Page

Adding a Page Number to a Footer

To display a page number in the header or footer of a report, create a text box in the footer and add the following expression:

=Globals.PageNumber & " of " & Globals.TotalPages

Linux: Quickly block an IP address from HTTP/HTTPS access using IPTables

/sbin/iptables -A INPUT -p tcp -s <source IP: 4.2.2.2> --dport 80 -j DROP

/sbin/iptables -A INPUT -p tcp -s <source IP: 4.2.2.2> --dport 443 -j DROP

Two quick MySQL tips

MySQL: Running a SQL script from the command line:

mysql mydatabase -u<mysql username> -p<mysql password> < /home/mysqlscript.sql

MySQL: Stopping a long query:

mysqladmin processlist

Get the id from the first column then run:

mysqladmin kill <ID>

Activating Windows shortcut command

c:\windows\system32\oobe\msoobe.exe /a

Get Mailbox Sizes in Exchange 2007 using Powershell

Paste the following into the powershell command prompt:

Get-MailboxStatistics -Database "mailbox database" | Sort -Property DisplayName | ft DisplayName, @{expression={$_.totalitemsize.value.ToMB()};label="Mailbox Size(MB)"}, itemcount > c:\mailboxes.txt

a text file located at c:\mailboxes.txt should now contain the mailbox size information with item counts for each user.