Monday, June 23, 2008

SharePoint object disposal

Special thanks to Brian, who commented on our Creating a Page Layout posting. I had forgot to create a using statement to automatically dispose of SPWeb in my feature receiver. Brian referred me to another blog post which gives an excellent listing of disposal concerns and best practices for overcoming them in SharePoint.

I strongly encourage you all to review these and ensure you are informed on when and why you should dispose of your SharePoint objects.

Tuesday, June 17, 2008

Visio Stencil for SharePoint Customization

If you're trying to brand/customize SharePoint you might want to check this out. It's a stencil for Visio that lets you do your design without having to work in SharePoint, HTML, or a graphics program.

Wednesday, June 11, 2008

ERROR: Exception from HRESULT: 0x81070201

When using STSDEV to create a custom list as a feature, I had my solution deploying and my feature activating without a problem, but then when I created the list I got the error:

ERROR: Exception from HRESULT: 0x81070201

I looked through the log files and found that the Schema.xml file was not included in my feature manifest as an <ElementFile> element. Once I added this it fixed this error

Monday, June 9, 2008

Understanding Content Type IDs and a Reference

Microsoft provides a very thorough explanation of ContentTypes here but you may be left wondering what content types you can inherit from (or more likely what are their content type IDs) so you can build off of them. Well you can always go look at them in the 'ctypes' feature folder (that's the out-of-box feature that defines the WSS content types). It's available at under your 12\TEMPLATE\Features\ctypes folder in the 'ctypeswss.xml' file.

Otherwise you can just refer to this list I pulled together:

0x : System
0x01 : Item
0x0101 : Document
0x010100629D00608F814dd6AC8A86903AEE72AA : ODCDocument
0x010100B4CBD48E029A4ad8B62CB0E41868F2B0 : UDCDocument
0x010101 : XMLDocument
0x010102 : Picture
0x010104 : UntypedDocument
0x010105 : MasterPage
0x010107 : DocumentWorkflowItem
0x010108 : WikiDocument
0x010109 : BasicPage
0x01010901 : WebPartPage
0x01010A : LinkToDocument
0x01010B : DublinCoreName
0x0102 : Event
0x0103 : Issue
0x0104 : Announcement
0x0105 : Link
0x0106 : Contact
0x0107 : Message
0x0108 : Task
0x010801 : WorkflowTask
0x010802 : AdminTask
0x0109 : WorkflowHistory
0x010A Person
0x010B SharePointGroup
0x010C DomainGroup
0x0110 : BlogPost
0x0111 : BlogComment
0x0116 : FarEastContact
0x0120 : Folder
0x012001 RootOfList
0x012002 : Discuss

By the way, I got this list by copying/modifying the files I used in this post to refer to the ctypeswss.xml file instead of the field types file.

Great SharePoint resource for Developers

Microsoft has a 10 part lab series which introduces several fundamental development tasks using SharePoint 2007. In addition there's a link to a VPC download that you can use to do the work.

Check it out here

Friday, June 6, 2008

STSDEV and Visual Studio 2008

So we're upgrading to VS 2008 and, according to the configuration screen in STSDEV you can create STSDEV projects in .NET 3.0 for VS 2008. So we installed VS2008, added STSDEV as an external tool and created a test Workflow Project.

The project was created fine but when STSDEV tried to build the project it crashed. We eventually discovered that the error was related to the fact that STSDEV was creating the .csproj file with the following line:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />

instead of:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

You can manually go into your .csproj file and change this and your solution should build.

We're looking into modifying the STSDEV code to rebuild the project so that it will do this automatically, but until we figure that out and get it blogged, here's your quick fix.

Thursday, June 5, 2008

Renaming a Sharepoint 2007 / WSS 3.0 Server

I recently needed to rename my Sharepoint development machine so I could move it into a new collaborative development environment (versus standalone in a workgroup). A little searching turned up this tutorial[] from a while back, which worked with a slight modification. I have reposted the contents of the tutorial below, with a slight modification (see original post and comments for details).

Note: The new collaborative environment uses Team Foundation Server 2008, so look for a later post on collaborative Sharepoint development using TFS.

First: Change each alternate access mapping for your MOSS/WSS deployment in Central Administration
  1. Open Central Administration
  2. Click on the “Operations” Tab
  3. Click on the “Alternate access mappings” link under the “Global Configuration” heading
  4. Modify each mapping item to reflect your newly chosen server name, making sure to keep port numbers the same (this also include the mapping for Central Administration, don’t worry it's cool)
Second: Use stsadm.exe to invoke the “renameserver” command option
  1. Open a command prompt window and navigate to the folder where stsadm.exe sits. Normally “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”.
  2. Use the renameserver command as follows, replacing and with the new and old names of your server:

    stsadm -o renameserver
    <newname> -oldservername <oldname>

Third: Rename your Server via Change Name Operation in Windows Server 2003
  1. Now the last step is to simply right click on My Computer
  2. Open “Properties”
  3. Click on “Computer Name” tab
  4. Click “Change” button
  5. Input your new server name and reboot the server

[added by Sharepointers]
Fourth: Use stsadm.exe to invoke the "updatefarmcredentials" command option
  1. Open a command prompt window and navigate to the folder where stsadm.exe sits. Normally “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”.
  2. Type in the following command and press [enter]:

    stsadm -o updatefarmcredentials -identitytype NetworkService
Note: After the command completes, you may need to run iisreset, using the /noforce option.

Monday, June 2, 2008

Directory of public sharepoint sites

The people over at wssdemo have put together a nice listing of public sites that use WSS or Sharepoint 2007 to some degree or another.

So, if you're in the middle of a design-related mental block, these are a great for getting your mojo back.