SharePoint Sharpener

Obsessively Sharpening SharePoint

Archive for March 2009

Programmatically Checking if a SharePoint Element is Published

with 3 comments

Here’s a quick tip for you: How to check if the latest version of an element in a SharePoint list is published.

Once you’ve got hold of an SPListItem, you can check the Versions property (an array containing all the versions of the element).

In this block of code IsPublished becomes True if the latest version is published:

bool IsPublished = TheItem.Versions[0].Level == SPFileLevel.Published ? true : false;

 

That’s it.

Written by Thomas Sondergaard

March 26, 2009 at 6:25 pm

JavaScript Tips for SharePoint

with one comment

I’ve gatherered a few productive tips for using JavaScript within SharePoint. The below commands can be used within webparts etc. or directly in the browser’s address field while you’re on a SharePoint page, like this:

Putting javascript: in front of your script snippet will fire it right there and then.

These commands are neither terribly advanced nor applicable on all pages, but they make for a useful reference all the same. I aim to continually update this page with new content so if you have any JavaScript tips, feel free to drop them in the comments.

 

Edit an application page: MSOLayout_ToggleLayoutMode()

This enables edit mode on SharePoint’s application pages, like EditForm.aspx, DispForm.aspx etc. so you can insert web parts above or below the normal content:

 

Pop-up an alert with the User ID og the logged-in user: alert(_spUserId)

 

 

Enable the Edit toolbar: javascript:__doPostBack(‘ctl00$PlaceHolderTopNavBar$SiteActionsMenuMain$ctl00$wsaShowMenu_CmsActionControl’,’reviewPage’)

Simply enables the toolbar where you can access the page edit functions:

 

 

Hide the Edit toolbar: __doPostBack(‘ctl00$PlaceHolderTopNavBar$SiteActionsMenuMain$ctl00$wsaHideMenu_CmsActionControl’,’exitMenu’)

No prizes for guessing this one.

 

Show help: TopHelpButtonClick(‘NavBarHelpHome’)

Pops up the built-in help page. Interestingly, you can try this on Microsoft’s SharePoint Conference web site:

Written by Thomas Sondergaard

March 23, 2009 at 11:31 pm

Posted in Development

Tagged with , ,

Travel with the Experts to the SharePoint Conference

leave a comment »

Last year PeopleNet gathered more than 30 Danish SharePoint enthusiasts for a series of events at the SharePoint Conference in Seattle.

The events went down a storm and the Danish delegation benefitted a great deal from the networking facilitated by PeopleNet.

 

Next stop Las Vegas

This year, we are taking things a step further – we are putting together a complete conference package which includes:

  • Return airline ticket (Copenhagen – Las Vegas)
  • Hotel (Mandalay Bay)
  • Conference pass
  • Special events during the week of the conference

This way, SharePoint stakeholders from different Danish organisations get to travel with like-minded people instead of going to the conference alone.

 

For more info (in Danish), click here.

Written by Thomas Sondergaard

March 2, 2009 at 12:56 pm

Posted in News

Tagged with , ,