Tuesday, April 19, 2011

Understanding The SharePoint SPContext Class

When developing new functionality for your SharePoint site the SPContext class is pretty much critical. Whenever you want to get your hands on objects in your current context you will need SPContext. As the name implies it helps you get information and objects regarding the context you're working in. It shouldn't be hard for any developer to see the use of that.

SharePoint Get Current Web


So, if the task at hand requires you to get information regarding the web your are currently working with you will use the SPContext. That could look something like this:
SPWeb oWeb = SPContext.Current.Web;

That line of code is off course blatantly borrowed from the MSDN article mentioned below. However, that's the way to get your current
SPWeb
object and from then on you can start working with the object.

What Can I Get With SPContext?


According to the MSDN article on SPContext you can work with web applications, site collections, sites, lists and list items. That's more or less anything you would want to get your hands on in the current context. Also it's worth taking a look at the members list I link to below. This gives you a pretty solid overview of the information you can get out of the SPContext class.

SPContext Members At A Glance


All SPContext members are listed in the SPContext Members article. I think it's fair to say that
Current
is the most notable. Off course, That is often used in conjunction with the
Site
and
Web
members. Looking at the list you can certainly fint many uses.

It's definitely worth it familiarizing yourself with the SharePoint SPContext class as there is no doubt you will be using it frequently. Also make sure you know when and when not to dispose your SPSite and SPWeb objects. In the long run those undisposed sites and webs will cost you a lot of unnecessary server resources if you don't handle them correctly.

Monday, April 18, 2011

SharePoint 2010 Training That Truly Rocks

Last Sunday I arrived at a week long training course for SharePoint 2010. It was a Firebrand course in Sweden leading to the 70-573 and 70-576 certification tests for SharePoint.

Given that I had no previous experience with SharePoint at this time it wasn't a surprise that I would struggle to pass the exams. However, I did in fact manage to pass the 70-576 exam, which is a real testaments to the instructor!

Believe me, the exams are not easy! And not the type you can expect to pass easily without any experience.

So, it could have gone better, but at least I got what I came for. I got knowledge to dive right in and start doing a job. The knowledge gained on the course combined with my previous ASP.NET experience gives me great confidence in my venture into SharePoint.

Having said that, it's been a tough week with virtually no sleep. And I don't want cola anytime soon!

The Staff - Credit Where Credit Is Due!


There is no doubt that one of the great experiences has been the staff at the facilities. In particular our instructor, Joel, who put in a herculean effort all week. You can find a link to his blog on the right, it is well worth a visit!

The rooms are nice as well, especially for a place where you just have to sleep and study. You won't need it for anything else!

When all is said and done, there is no doubt that if you go on this course you will learn a lot. You will be tired in the end of it, but it will be worth it! If you are in a situation where you can go away for 7 days and immerse yourself in one topic you should do it!

For me the next step is to pass the 70-573 exam. I will write about my progress on this space.

Wednesday, April 6, 2011

Conceptual Overview Of SharePoint Foundation In SharePoint 2010 - Clearing Up The Confusion

Based on the MSDN Library Article Conceptual Overview of SharePoint Foundation.

Having read the above article numerous times it became obvious that I would need to rewrite the content in my own words to ensure full grasp of the content. This would probably not be necessary with in-depth prior knowledge of the SharePoint Foundation.

Basically the SharePoint Foundation is an application build on top of the IIS and the .NET Framework. So, we're dealing with a regular .NET application with certain built-in features we can take advantage of. The Microsoft SharePoint Foundation runs on a set of servers known as a server farm. Really, this doesn't seem much different than most other ASP.NET applications where you will also usually use a set of servers to keep your application running smoothly. The Farm can have multiple front-end servers and multiple database servers. This too, doesn't seem to differ greatly from "regular" ASP.NET development seeing as you would usually like to have at least some failover built-in to your set up. The need for a configuration database and a content database might differ somewhat from regular ASP.NET development. It doesn't have to, but it certainly can. The difference between the two databases should be obvious, but to spell it out the configuration database is all about configuration of the system and its administrators and the content database on the other hand is all about the content. User information is considered content and is therefore stored in one of the content databases.

The next topic of the article is site collections which I suppose is the next logical step. There can be only one!(Top level site) On the other hand, you can have as many child sites as you wish within the site collection. What binds a collection together is a set of common elements including permissions, galleries and Web Parts. It is different from other site collections in its permissions and it has its own administrator. In the collection a site stores content in pages libraries and lists and it can be secured to allow only specific users access to the site. The great thing is that this also makes it incredibly easy to target specific users with content relevant only to them.

The basic oblect type is the list. The list has many forms and functions ranging from task lists to event lists and various others. The colums in the lists are also called fields and can be customized to fit the type of content you need to show. Something that is rather fortunate as you are rarely required to use only existing functionality. As a note even though document libraries sound very file explorerish they too are just lists. Albeit very specialized lists.

The extensibilty framework that also includes deployment. Obviously you can use these features to apply the web technologies you are already familiar with, but it also allows for different deployment models. You can either deploy as a Feature or as solution package.

Although the SharePoint Foundation may be a brave new world for you the fact that it is built on familiar web technologies should enable you to find familiar ground. For this is a brave new world, but one I'm looking forward to exploring.