Posts

Showing posts from November, 2010

SharePoint 2010 Timer Job UpdateProgress

Image
SharePoint 2010 has updated some of its timer job features (see  http://pathikhrawal.wordpress.com/2010/08/21/enhancement-in-timer-jobs-in-sharepoint-2010/ ). Now SPJobDefinition offers an UpdateProgress Method, to show the status of the timer job in a status bar. UpdateProgress To check the status of a timer job go to "Central Administration > Monitoring > Check Job Status". Check Job Status link in the CA The following code snipplet  is an example of how you could use this method. The job reads a rss feed and uploads some pdf files into a document library. The progress bar is updated by each uploaded file. The snipplet is not complete, because of copyright. I commented out some regions but you can see how you could use the updateprogress function. public class PressListTimerJob : SPJobDefinition {   /// <summary>   /// We must persist the to have in the execute function   /// </summary>   [Persisted]   private String mRootSiteU

Play a video from a asset library in SharePoint with the built-in Silverlight Media Player

Image
The Problem: You want to place a link into your SharePoint site which opens the Silverlight player in a lightbox and plays a video from a asset library. Solution: 1) Place the link within an other HTML element like a div, li or span and give this element an id. The link can be somewhere in this container, also in a deeper level - the link to the video must be serverrelative - the link can have a title. This can be used as Video title <div id="mediaplayer">    <a href="/site/listname/myvideo.wmv">Video</a>  ..  .. </div> Video link 2.) Place a script tag for the mediaplayer library and a custom script tag for our custom js. You must place it after or in the onload event, because when you use getElementById the element must exist in the DOM. <div id="mediaplayer">    <a href="/site/listname/myvideo.wmv">Open Video</a>  ..  .. </div> <script type="text/javascript"

Setting the default page layout in onet.xml (SharePoint 2010)

Image
In SharePoint 2010 you have the option to choose a default page layout when you create a page. Setting the default page When you create a new page, a dialog pops up where you enter the name of the site. You can configure your onet.xml and define the default page by the defaultpagelayout property in the publishing feature. Or you can set it programmatically as described in SharePoint Blues . There are also several other properties offered by the Publishing feature you can set: ChromeMasterUrl WelcomePageUrl PagesListUrl AvailableWebTemplates AvailablePageLayouts NewPageUrlToken AlternateCssUrl SimplePublishing VersioningOnPages / Documents / Images EnableModerationOnPages / Documents / Images EnableApprovalWorkflowOnPages / Documents / Images RequireCheckoutOnPages / Documents / Images EnableSchedulingOnPages /Documents / Images AllowSpacesInNewPageName Each property needs a different value. You can find a good listing of the properties and values

ContentTypeBinding Error - Object reference not set to an instance of an object

An error occurred binding content type '0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900...' to list '/ct2/Pages' on web 'http://pilatus/ct2'.  Exception 'Object reference not set to an instance of an object.' . This exception occures when you try to bind an empty or non-existent content type to a list. An empty content type is a content type with no fields. Example of an empty content type. <ContentType ID="0x010100C568DB52D9D0A14.."      Name="Basic Page"   Group="Custom.Pages"   Description="Basic Page" >      <!-- here must be some fields -->     <DocumentTemplate TargetName="/_layouts/CreatePage.aspx" />   </ContentType>

MatchPoint Condition - Show only data from last months

Image
If you have a MatchPoint Composite oder DataGrid WebPart and you want to show data from a list which is from current month, from the last months or coming months you can use following condition(s). The field you check should be DateTime field. MP Configuration The condition checks if the content of the Date field is lower than the 1st of the current month. If you want the last day of the month, you can use AddMonth(1).AddDays(-1)

How to hide the SharePoint Ribbon in Non-Edit Mode

If you’ve ever developed a page for SharePoint 2007 you certainly used the EditModePanel control to control content visibility. This control now has changed in SP 2010 and ignores the Page Editmode. But there is a possibility to do this with no custom code.  Locate the position of the class "s4-ribbonrow" and add a display style. (Or overwrite the class in your css). This will hide the panel in DisplayMode. <div class="s4-pr s4-ribbonrowhidetitle" id="s4-ribbonrow" style="display: none;" > Add following code after the ribbon div. This will show the ribbon in EditMode. <publishingwebcontrols:authoringcontainer displayaudience="AuthorsOnly" runat="server"> <publishingwebcontrols:editmodepanel pagedisplaymode="Edit" runat="server"> <script type="text/javascript">   document.getElementById("s4-ribbonrow").style.display = "block"; </script> &l