Introduction to WSSv3 OM
Hey folks, as promised--we have hit the Beta2 mark, so here come the blogs again. I have had the opportunity to work with many of you in our private TAP and Beta programs, which I have enjoyed very much. I hope to initially share some of the knowledge that I gained during this experience with the rest of you. First--I want to provide you with what I would consider to be some important links. If you have questions on something I discuss here, I would ask that you look in these sources first before posting. Here's the links:
1st, get the Beta:
www.microsoft.com/office/preview/beta/getthebeta.mspx?showIntro=n
2nd, get the WSSv3 SDK:
www.microsoft.com/downloads/details.aspx?FamilyID=05e0dd12-8394-402b-8936-a07fe8afaffd&DisplayLang=en
3rd, get the MOSS SDK+Samples:
www.microsoft.com/downloads/details.aspx?FamilyID=6d94e307-67d9-41ac-b2d6-0074d6286fa9&displaylang=en
4th, get the MOSS ECM Starter Kit (this includes workflows):
www.microsoft.com/downloads/details.aspx?FamilyID=38ca6b32-44be-4489-8526-f09c57cd13a5&displaylang=en
5th, get the Project SDK+Samples (this is not an area I'll be talking about, but wanted to provide the link):
www.microsoft.com/downloads/details.aspx?FamilyID=2672f6f9-7028-4b30-99a2-18cb1eed1abe&DisplayLang=en
It is worth pointing out that so far in SharePoint 2007, I have had focus on Workflow, Content Types, Features, general administration, and obviously... the OM. Do keep in mind that I also have spent some time familiarizing myself with the differences on using VS2005 and the current extensions in windbg for debugging in a SharePoint 2007 environment.
So, lets get on with it. For our first code sample--I want to point out one of the most obviously OM changes that you just simply "need" to know about. We are planning to mark the following WSS classes as Obsolete:
SPVirtualServer
SPVirtualServerConfig
SPGlobalAdmin
SPGlobalConfig
I need to stress here that we fully intend to keep these classes working and backwards compatible with code written against WSSv2. This is simply to enforce that we have a new object model that you should be using in your new code moving forward. So as a part of that effort, I am going to re-demonstrate how to accomplish some of the common tasks but using the new object model.
Here is some code to do some basic enumeration. This would in a sense get you into the areas that are mentioned above and then some. This also of course can get you into what might before only be in the topology manager (via SPFarm.Servers) and other areas that I'm sure you will figure out as you start to play.
In order to get this code to work, you simply need a new c# project. Add a reference to Microsoft.SharePoint (its the third one from the bottom in the browser), and then add:
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration; //For SPFarm, SPServerCollection, SPWebApplicationCollection
Then just give yourself a button or something and run this code:
SPFarm mySPFarm = SPWebService.ContentService.Farm;
SPServerCollection mySPServerCollection = mySPFarm.Servers;
SPWebApplicationCollection mySPWebAppCollection = SPWebService.ContentService.WebApplications;
if (mySPWebAppCollection != null)
{
foreach (SPWebApplication mySPWebApp in mySPWebAppCollection)
{
Console.WriteLine("WebApplication: " + mySPWebApp.Name);
Console.WriteLine(" AppPool: " + mySPWebApp.ApplicationPool.Name + " (" + mySPWebApp.ApplicationPool.Status + ")");
SPContentDatabaseCollection mySPContentDBCollection = mySPWebApp.ContentDatabases;
Console.WriteLine(" # Content DBs: " + mySPContentDBCollection.Count);
foreach (SPContentDatabase mySPContentDB in mySPContentDBCollection)
{
Console.WriteLine(" Database Name: " + mySPContentDB.Name);
Console.WriteLine(" Database Server: " + mySPContentDB.Server);
Console.WriteLine(" DSN: " + mySPContentDB.DatabaseConnectionString);
}
}
}
Obviously, if you know a specific URL, you're going to still use SPSite in some fashion to get directly to a SPSite or SPWeb object. Hopefully this will get you started into some of the higher level objects in WSSv3.
Comments
Anonymous
June 28, 2006
Trackback from SharePointKicks.comAnonymous
July 04, 2006
It's been a while since Dan Winter has posted anything on his blog, but it was worth the wait. His introduction...Anonymous
July 17, 2006
Here is an assortment of various 2007 Microsoft Office SharePoint Server Documentation / Reference Materials...Anonymous
December 06, 2006
Этот пост содержит ссылки на важные материалы, c помощью которых можно качественно повысить уровень знанийAnonymous
February 07, 2007
It is nice article It will be very much usefull if it will display all the detail and complete structure of MOSS 2007 object model SharePoint 2007 Object Model It's very urgent !!! If anybody have any Idea Please let me know.Anonymous
September 13, 2007
2007 MOSS Resource Links (Microsoft Office SharePoint Server) Here is an assortment of various 2007 MicrosoftAnonymous
December 11, 2007
Body: Application Development on MOSS 2007 & WSS V3 Beginning custom SharePoint development withAnonymous
February 18, 2008
Gracias a Mark Kruger (SharePoint MVP) por esta lista de recursos de SharePoint donde podréis encontrarAnonymous
February 18, 2008
Gracias a Mark Kruger (SharePoint MVP) por esta lista de recursos de SharePoint donde podréis encontrar