Thursday 25 April 2013

Paste content into SharePoint with no formatting

Hello Again,

These days I am working heavily into SharePoint Ribbon customization. If you have not read my previous blog on this, I would recommend you to read Previous Ribbon Blog before reading this one.

SharePoint 2010 brings the new evolution in user interface and have brought common functionalities into same page by introducing the Ribbon concept.

In SharePoint user is allowed to copy content from various sources like email, office applications like word, excel  and paste into SharePoint.

By default there are two ways to paste content into SharePoint from ribbon.


1. Paste (paste content with styles and formatting)
2. Paste palintext (paste content without styles but keeps the formatting)


However; pasting the content even as Plain text from word and other sources into SharePoint  introduces breaks and other markup issues in Html.

Paste  (format:break line and color:Blue)
Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | out-null
Write-Host "Hello All"

Paste Plaintext (only format:break line)
Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | out-null
Write-Host "Hello All"

I wanted to achive something shown below.

Paste with no formatting (no format no color)
Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | out-null Write-Host "Hello All"



I have created a sandbox solution and added element.xml as shown below. On click of this flyout anchor menu I have called a javascript function as defined in commandaction attribute in the command handler.

Hope you find this useful.
Cheers,
Isha Jain

Friday 5 April 2013

How to find a SharePoint field from GUID

Hello,

I have been in a scenario where I need to find one of the SPFields from its GUID. Its again PowerShell who saves my time.


$site = Get-SPSite -Identity "http://Site"
$web=$site.RootWeb
$field=$web.Fields[[Guid]"E9359D15-261B-48f6-A302-01419A68D4DE"]

That's it, I am done!!!

Cheers,
Isha Jain