Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Tuesday, August 12, 2014

Provision SharePoint ClientWebPart custom properties through PowerShell

Currently developing on projects where a lot of SharePoint provider hosted apps are involved. App parts with custom properties are used to integrate them on SP webpages and I needed to provision those properties through PowerShell.
Not really rocket science, but couldn't find anything on the web and needed to decompile to find the solution, so decided to drop it here. The ClientWebPartProperty does the job:

$webpart = New-Object Microsoft.SharePoint.WebPartPages.ClientWebPart
$newProperty = New-Object Microsoft.SharePoint.WebPartPages.ClientWebPartProperty
$newProperty.Name = "nameoftheproperty"
$newProperty.Value = "valueoftheproperty"
$webpart.Properties.Add($newProperty)

Don't forget the set the FeatureId, WebPartName and ProductWebId properties as explained here.

Saturday, March 2, 2013

Livestamp Your SharePoint Items

Last week I came across a small, nifty jQuery plugin, called Livestamp. It provides an auto-updating timeago text for timestamped HTML. In other words, a much more human readable representation for a datetime value. You can see some demo's here. I'm aware that there're some other similar projects, but in my opinion Livestamp is the most simple and active one at the moment.

SharePoint is loaded with less readable datetime values, so I searched for some nice Livestamp integration. Unfortunately I couldn't find a ready-to-roll, packaged solution and since I think some neat integration could be useful, I decided to build one.

It's a custom field for SharePoint 2010. When the solution is deployed there's an option to create a Livestamp column in your lists. When creating a new column you need to select a related date column. If the date column holds a date or datetime value, the Livestamp column will render the related, auto-updating, timeago text.

Solution package and source code are available at Codeplex.


v0.1.1:
- Added support for Calculated and Lookup columns with DateTime output
- Sorted column selection (alphabetically)

v0.1.0:
- Initial release