Cory Peters

Adventures with SharePoint and .Net

Sep

29

Undocumented List Definition Properties

By Cory

While the MSDN article gives most of the properties that you can use when configuring your list definition it does miss a few. I’ve documented the missing properties that I’ve found below:

Attribute

Description

ForceCheckout Optional Boolean. TRUE to require documents to be checked out before they can be edited.
EmailAssignTo Optional Boolean. TRUE to automatically send emails to the user when an item is assigned to them.
MajorVersionLimit Optional Integer. Specifies the number of major versions to retain when versioning is enabled.
MajorWithMinorVersionLimit Optional Integer. Specifies the number of draft versions to retain for each major version when versioning is enabled.

Sep

24

Querying a SharePoint List with LINQ

By Cory

I am continuously seeing the value in LINQ and I think with the upcoming changes in SharePoint 2010 I plan on making LINQ an even bigger part of my normal development practice.

First establish an SPList object of the list you would like to query data from.

SPList list = web.GetList("/Lists/ListUrl");

Next query the list; taking advantage of the filtering and sorting capabilities built into LINQ

var listItems = from SPListItem item in list.Items
                            orderby item.Title
                            ascending
                            select item;

And with a where query utilizing a custom field!

var listItems = from SPListItem item in list.Items
                            orderby item.Title
                            ascending
                            where ((DateTime)item["CustomExpirationField"]).DayOfYear >= DateTime.Now.DayOfYear
                            select item;

Now feel free to loop through your data and take care of business!

foreach (SPListItem item in listItems)
{
     // item.Title
     //etc
}

Sep

13

Five SharePoint Technologies to Invest In

By Cory

With SharePoint 2010 around the corner I bring you five SharePointe technologies to invest in. Not in any particular order…

Silverlight

silverlight

What is Silverlight?

“Silverlight helps you create rich web applications that run on Mac OS, Windows, and Linux. Welcome to a new level of engaging, rich, safe, secure, and scalable cross-platform experience.”

In short Silverlight is the Microsoft competitor to Adobe Flash. Silverlight runs on the client side and is designed to communicate with backend systems via web services. It provides a rich experience with functionality such as playing videos, music, charting and rich web based user interfaces.

Why Should I Invest In It?

SharePoint 2010 is shipping with a new web part out of the box appropriately named the “Silverlight Web Part”. This web part will be a container or shim for any Silverlight applications that you would like to host within SharePoint. SharePoint 2010 also comes with a Client Object Model which will allow you to interface with the SharePoint objects using client side Silverlight code and avoid the need for building or using one of the out-of-the-box web services. This should greatly speed up development and allow developers to write rich interfaces, views and dashboards surfacing SharePoint data using custom Silverlight web parts. Read more »

Aug

26

Shared Services Between Farms

By Cory

So let’s say that you have multiple SharePoint farms but want to search across them… enter “Shared Services Between Farms”. In this scenario you set one farm to be the provider and a second farm to be the consumer. The provider farm shares it’s Shared Service Provider with the consumer farm allowing you to associate one of your consumer farm’s web applications with one of the provider farms Shared Service Proviers.

Let’s get started… Read more »

Aug

20

Praises to chkdsk!

By Cory

Story time.

The other night I was up late finishing some work for a client when my Western Digital 250GB external hard drive hiccuped. I heard the disc click and spin a little as if it suddenly had some work to do or something happened. Concerned I alt-tabbed over to my Virtual PC window to see the wonderful blue screen of death. I immediately shut down the virtual and tried to start it back up but it wouldn’t even boot… not even into the BIOS just a completely corrupt virtual hard disk. I immediately made a copy of the virtual disk hard drive (the VHD file) and starting backing up files off of the external. Files wouldn’t even copy off the drive! It wasn’t just my virtual, my whole drive was corrupt but I did have an idea… Read more »

Aug

6

Best Kept Windows 7 Secrets

By Cory

Tim Sneath over at Musings of a Client Platform Guy has just posted an excellent article on all gems you can find in Windows 7 that few know about. I definitely learned some tricks including the following:

  • New keyboard shortcuts
  • The Blackbox Recorder
  • New mouse shortcuts
  • Specialized windows switching
  • and more…

Read the rest at The Bumper List of Windows 7 Secrets. Thanks Tim!