TwitterLinkedInBlog

Tuesday, August 31, 2010

SP2010 - Share Link To Current Page

.aspx:
<asp:HyperLink ID="ShareHyperlink" runat="server" Text="Share" ToolTip="Share" />

function shareLinkInEmail(subject, body) {
var escapedSubject = escapeProperly(subject);
var escapedBody = escapeProperly(body);
window.location='mailto:?subject=' + escapedSubject + '&body=' + escapedBody;
}

c#:
ShareHyperlink.NavigateUrl = "javascript:shareLinkInEmail('Testing', 'Testing' + String.fromCharCode(13) + '" + Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + Request.RawUrl + "');";

Thursday, August 26, 2010

SP2010 - Sunil Yadav - Developer Dashboard

Copied and pasted directly from Sunil Yadav ...
http://www.sunilyadav.net/?tag=developer-dashboard-powershell
... because I'm tired of googling and finding outdated beta techniques.

The developer dashboard is the new feature addition to SPS 2010 diagnostics. The Developer dashboard provides detailed information such as components generating load on the system, code that executed on the page, query execution time, function by function level trace, WebPart load time etc.

Developer Dashboard Modes:
  1. On : Developer Dashboard is viewable on all pages that use the default master page.
  2. Off : Turns off the Developer Dashboard.
  3. OnDemand : Allows the user to toggle the Dashboard on and off.

The Developer Dashboard is disabled by default. One can enable the Developer Dashboard with the help of following methods.

1. Using STSADM.EXE
STSADM.exe -o setproperty -pn developer-dashboard -pv OnDemand

2. Using PowerShell
Open SharePoint 2010 Management Shell
Run following script on the Sharepoint 2010 Management Shell.
$devdashboard =[Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
$devdashboard.DisplayLevel = 'OnDemand';
$devdashboard.Update()

3. Using Object Model
SPWebService service = SPWebService.ContentService;
service.DeveloperDashboardSettings.DisplayLevel=Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel.OnDemand;
service.Update();

Monday, August 23, 2010

VS2010 - Sahil Malik - Strong Name

Reference: Sahil Malik's blog: http://blah.winsmarts.com/2009-12-SharePoint_Productivity_Tip_of_the_day.aspx

This is an improvement over the sn.exe technique which only give you the public key token. Sahil's technique gives you output you can copy and paste directly into an assembly attribute.

Visual Studio > Tools > External Tools > Add > Title: S&trong Name; Command: Powershell.exe; Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"; Use Output Window: Check > OK.

Friday, August 6, 2010

Browser Web Development Tools

Internet Explorer 8 (ie8):
F12 -or- Alt > Tools > Developer Tools

Safari:
Alt >Edit > Preferences... > Advanced > Show Develop menu in menu bar.
Ctrl+Alt+I -or- Alt > Develop > Show Web Inspector.

Firefox:
Install Firebug (http://getfirebug.com/)
F12 -or- Alt > Tools > Firebug > Open Firebug