SharePoint Sharpener

Obsessively Sharpening SharePoint

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

3 Responses

Subscribe to comments with RSS.

  1. Thanks. save me some hours 🙂


    June 22, 2009 at 9:25 am

  2. if it is a file, you can also use this:

    bool isPublished = (TheItem.File.Level == SPFileLevel.Published);

    Ah Lun

    July 30, 2009 at 11:01 am

  3. Appreciated,helped me alot.


    October 7, 2009 at 1:06 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: