Posts

Showing posts from 2008

Calculated Column to Write out the Month

I have many many lists that I want to group by month based on their creation date (or other date column). In order to do I thought I'd have to add a calculated column and then add a horrific formula of nested IF's. Thankfully this formula does the trick: =TEXT([Article Date],"MMMM")

Web Services on your dev machine

If you've ever tried to create a web service using a SharePoint development machine (using Visual Studio), you'll recognize this error: "Visual Web Developer does not support creating Web sites on a SharePoint Web server." Arrgh.. so annoying. Luckily there's an easy workaround: First, create a new web application in your webroot folder (probably c:\Inetpub\wwwroot) by creating a folder with explorer, and then application-izing it using the IIS Administration snap-in. Then, go back to Visual Studio and re-try to create the web service (File->New Web Site) using the name from the folder you just created. Tadaaaa...

Map a drive letter to a SharePoint document library

This is a cool trick that I hadn't thought of...

Debugging features with STSDEV

I've been banging my head for a few days trying to debug a feature receiver that I built and deployed using STSDEV. After scouring the web I found lots and lots of questions, and typically the same, incomplete, answer. To get things to work, this is what I had to do: In VS2008, click on Project->Settings->Debug. When you get to the debug settings for your project, you'll notice each of your build targets in a dropdown at the top of the page. Select a target and then scroll and click the 'Advanced' button. By default, STSDEV doesnt generate a PDB for most of its build targets, so you'll want to change the "Debug Info" drop-down selection to "full". Repeat for each build target that you need debug info to be generated for (at least DebugDeploy and DebugRedeploy). Build and deploy your solution using one of the targets you changed above. Map a drive to \\machinename\c$\windows\assembly. This allows you to see the file structure of the G...

System Pages Shortcuts

I recently found a list of SharePoint system pages that someone compiled, and thought "man, it would be nice to have these in IE as favorites". So... I put together a little vb script that adds them. Before you run the script, open it up and change the rooturl variable to point to your site collection. This only works for IE, of course. download the script here

Do as I say, not as I do

After spending a looong time trying to figure out why my code behind for my page layout wasn't updating after making a simple change and doing an STSDEV Release build, I found out the hard way that you have to do a DebugBuild before you do a ReleaseBuild, otherwise it won't update the dll. Save yourself some frustration and add this to your list of todos each time you do a release in STSDEV. Thanks to fellow SharePointers blogger Grant for providing with technical/emotional guidance as I troubleshooted this issue.

Getting the current position of a contentquery result

I am using a content query web part and want to have the first record appear differently than the other records that come after it. In order to do this you need something like the xsl position() function to determine if you are at the first element or not. You can't use position() from within your ItemStyles.xsl template though (it always returns a 1). So you need to make two quick changes to get this working. First edit ContentQueryMain.xsl find the OuterTemplate.CallItemTemplate template Find this block: <xsl:when test="@Style='NewsCategoryItem'"> <xsl:apply-templates select="." mode="itemstyle"> [fix will go here] </xsl:apply-templates> </xsl:when> Add this to the spot I've indicated above: <xsl:with-param name="CurPos" select="$CurPosition" /> Save ContentQueryMain.xsl Now edit ItemStyles.xsl Add the following as the first ite...

SharePoint solution deployment getting stuck

I was deploying a solution into our production farm and found that after adding my solution and trying to deploy it (from Central Admin), the the timer job just got stuck on 'Deploying...'. I eventually discovered that one of our app servers had a problem with the Timer Service and shut down. I restarted the timer service and the solution finished deploying. Now it's time to figure out why the Timer Job failed...

SharePoint VHD Expansion

In my experience, a typical standalone MOSS installation on a Server 2003 machine will use at least 12-14Gb of space, not counting any other add-ons you're using (antivirus, etc). Unfortunately for those of us who use Virtual Server/Virtual PC for SharePoint development purposes, the default drive setup is a fixed-size 16Gb IDE drive, which doesn't leave much wiggle room. If you, like me, saw the 16 gigs during the installation and said "oh, that should be enough", and are now eating your words, this post is for you. Virtual Server/Virtual PC doesn't have a built-in way to resize .vhd files, but fortunately there are a few options available. Instead of using a somewhat pricey tool like Ghost, there are a few free alternatives. My favorite is appropriately named VhdResizer, and is available here [vmtoolkit.com]. After its installed, just point it at your old .vhd (shut down the vm first) and plug in the name/path of where you want the newer, bigger one. Allo...

Publishing Page Layout DateTimeField formatting

I wanted to have my DateTimeField show up with a different format than the 'short date' value that it defaults to. Unfortunately you can't just add a date format string to a field property to make this work. I've seen a few alternative ways to do this involving extending the DateTimeField control. But I didn't like those options and felt the way I finally figured out was a little nicer (in my opinion). Here's what I did: 1. Add a code behind page to your page layout and wire it up. If you don't know how to do this watch this short video by Andrew Connell . The 2nd part has to do with Page Layouts but you do the exact same thing as he does in the first part with the master page. 2. Add an 2 EditModePanels to your page layout like so: <PublishingWebControls:EditModePanel runat="server" ID="DateEditModePanel">   <SharePointWebControls:DateTimeField ID="ArticleDateControl" runat="server" FieldName="News...

Publishing Page Layouts and Images

I recently was working on a project and was trying to get a RichImageField in a page layout working. I ran into a speed bump which was my RichImageField was displaying the html markup for my image tag rather than the image itself. After pouring over the internet, I finally got it to work after I realized that I didn't include the 'SourceID' attribute in my field columns (SourceID="http://schemas.microsoft.com/sharepoint/v3").

Content Query Web Part

Sadly there is no built in cross-site list view web part. This seems like a pretty big oversight to me, but there are 3rd party tools that do the trick. However if you want that functionality from out of the box components you have to use a content query web part. Using the content query part is fairly straightforward but there are two things you must remember: The columns you are filtering on have to be site columns If you find some of your list fields aren't available to your itemstyle.xsl, it's likely you'll have to modify the web part's xml. In order to do this complete the following steps. Click the verb menu of the web part and choose to export the part to your file system Open the .webpart file on your file system and find the 'CommonViewFields' property and add your field and its type. Delete the old webpart from your page and reimport the webpart (click Add a web part to this zone then use the advanced settings to import, the import option is in the...

Custom list with content type item check-in throws "Value does not fall.." error

When checking in an item in a custom list, I was being presented with the following error: Value does not fall within the expected range. at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPFieldCollection.GetFieldByInternalName(String strName) at Microsoft.SharePoint.SPListItem.get_MissingRequiredFields() at Microsoft.SharePoint.ApplicationPages.Checkin.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) After much head-scratching and nightmarish debugging, I found that the answer was very simple: Do not have the "Required" attribute set to true in your content type definition, but rather specify this in your custom list schema. Hope this helps!

Programmatically Update Page Layouts

I updated my page layouts that I deployed as a feature, but found that I could not overwrite the Layout File. The solution was to add a new page layout and then you would have to associate the new layout with every page on your site that used it. Obviously with a site of any size you'd have a lot of manual work to get this done, so doing it programmatically makes for a much better (and thorough) approach. After you've got your new page layouts, you could do something like this (in your event receiver class): public override void FeatureActivated(SPFeatureReceiverProperties properties) { //replace current page layouts with new page layouts on all pages SPWeb web = SPContext.Current.Web; SwapPageLayout(web, "FullWidthContentWithTitleV1.aspx", "FullWidthContentWithTitleV2.aspx"); } private void SwapPageLayout(SPWeb web, string oldPageLayoutName, string newPageLayoutName) { PublishingWeb pubWeb = PublishingWeb.GetPu...

The Case of the Missing Icons

In a recent attempt to add some new filetype icons to SharePoint, I stumbled across an interesting problem... duplicate entries in the icon lookup file (...\12\TEMPLATE\XML\DOCICON.xml) cause icons to disappear, with the alt text "Item Icon" in their place. In my case, I added a Photoshop (.psd) icon for some of our designers. But, just like this guy , I quickly realized that SharePoint already has one. A duplicate entry will break icons in lots of places (search, for example), so edit with care.

Unicode Reference

When using SharePoint sometimes you run into a URL with lots of unicode character markup. Here's a good reference so you can figure out what the h%65ck it all means.

List Types and Base Types

Here's a good reference that I've been using for the all the List Types and BaseTypes:

Bulk MySite Creation

Image
Because SharePoint will display active links to MySites that might not exist, I was asked to "pre-create" all of the MySites before an upcoming rollout to prevent any confusion from "broken" links. I found a tool at codeplex called TIN that seemed to do what I needed, but it was a little clunky so I rewrote it. The new version is incredibly simple, but it might save somone some time so I thought I'd share. Basic features include: Bulk creation of MySites for entries in the ProfileManager Bulk deletion of MySites for entries in the ProfileManager List profiles from the ProfileManager and whether they have a MySite Robust logging and error handling Save-to-File for log results Multiple threads for long-running operations and smoother screen updates The source code isn't so beautiful, but here it is . Feel free to make any changes you like, and let us know if it worked for you. Also, if you do make changes and want to share, just send it in and we'l...

"This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application." in STSDEV

I recently created a Web Part based on the STSDEV Web Part project and found it was very simple to use. I had another Web Part to create but this time I decided to go with the more generic 'Empty Solution' project just to ensure I wasn't getting lazy with all the stuff STSDEV does for me. The project built, and installed properly into the solution store, but doing a 'DebugDeploy' failed with an error. I compared the two projects and they seemed to be configured identically. However upon further inspection, I found that the 'DebugDeploy' section of the Web Part Project (STS DEV generated) is different than the 'DebugDeploy' section of the empty solution. changing this line: <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment" /> to: <Exec Command="$(STSADM) -o deploysolution -name $(PackageName) -immediate -allowgacdeployment -allcontenturls" /> solved the problem. NOTE:...

Activating SharePoint Publishing Infrastructure Results in 'Access Denied'

I was getting a 'Access Denied' error when trying to activate the SharePoint Publishing Infrastructure feature. I found two solutions. The first involved changing the Application Pool that Central Admin ran under. The second, found here , simply involves running an STSADM command from the command line. In a production system, I'd say that the stsadm way to go (it's also faster).

SharePoint Slow?

Joel Oleson's blog has a great post on dealing with the slowness on first page request we've all dealt with.

Web Part Styles

There are many examples of how to create a web part. However the best way to style web parts is not necessarily well documented, so I thought I'd offer up my approach and see what the community thinks. Basically I create my web part as a feature in a solution. Then, if my web part generates any code that requires styling I add a .css file to my feature directory. Next I provision the stylesheet of my web part to a folder within my site's "Style Library". Finally I add the code into my web part to add the stylesheet ("<link>") link to the header of the page that my web part has been dropped on. Most of the stuff is straightforward but here's how to provision a style sheet to the style library: Add a "provisioning.xml" file to your feature and reference it in the ElementManifest section of Feature.xml in "provisioning.xml" enter the following: <?xml version="1.0" encoding="utf-8" ?> <Elements xml...

WebPart Error: [ArgumentException: The serialized data is invalid.]

You may run into this problem. In my case I had a legitimate serialization error, but when I took out the offending code I was still getting the same error. I found the solution is to close/readd the webpart to eliminate the error.

A very nice tool

This CAML builder tool is pretty nice. If you're like me and haven't memorized the CAML spec, it's incredibly useful to test your query in this and then paste them into your code. U2U CAML Query Builder IMPORTANT NOTE: When using the trying to Query a list, remove the <Query> tags from the query otherwise the query wont do anything aside from return the whole list!!

Build a Standalone VM for MOSS Development (or WSS Development)

This post is a fantastic starting place for building your own developer VM with SQL Server, AD, Email, MOSS, and Visual Studio. You should pretty much follow this verbatim, but here are a few points to make things go smoothly When Setting up SharePoint Search, make sure you include the Domain with the username (or you'll get a cryptic error ) After setting up SharePoint Search, if you're installing MOSS, turn on all the other services except for the document conversion related services. If installing MOSS, make sure you create an SSP. Don't delete the default web application, just stop it. Chances are deleting it won't hurt you but there are a few things that could get screwed up if you totally delete the default web application (for more info see this post ). Do yourself a favor and put STSDEV on there.

The call to SPSearchServiceInstance.Provision (server 'NTS499') failed. Setting back to previous status 'Disabled'.

I was creating a stand alone dev machine the other day and ran into this error. The simple fix is that you need to put in the accounts that the Search service will run as with their domain names. (E.g. DOMAIN\username, not just username) Quick and easy...

Turn on anonymous access

In order to turn on anonymous access (I had to do it so my XML Web Part could use a list's RSS Feed as an XML source) follow these steps. Enable Anonymous access on your Web Application in Central Admin. Go to 'Application Management' and choose the 'Authentication Providers' link. Choose your authentication provider in the appropriate zone and check 'Enable Anonymous Access'. Go to your site and turn on Anonymous Access by going to 'Site Settings' then 'Advanced Permissions' If there is no 'Settings' option in your advanced permissions list, then your site is inheriting permissions, you can either stop inheriting by clicking 'Actions'>'Edit Permissions' (after which the 'Settings' option will show, or you can choose to turn anonymous access on at the parent's level by choosing 'Manage Parent Permissions' Once you have the 'Settings' menu, choose Anonymous Access and turn it on at the S...

Using RSS and XML Web Part

I really like the XML Web Part because of its simplicity - take an XML data source, apply XSLT and have it pretty much whatever you want. I was recently asked to create a jump-to-list-item dropdown box so that you could place the web part on any page and a user could select an item from that list from a dropdown and it would take them to the list item. Here are the steps that it took to create this using the out of the box XML Web Part. Turn on anonymous access on your list ( here's how to do it ) RSS Enable your list and then view the RSS Feed (you can do this through the list's Action menu) Place an XML Web Part on your page Modify the settings of the XML web part by pasting your RSS Feed URL into the webpart's XML Source attribute. Open the XSLT editor and place the following code: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> ...

Email Enabled Lists

After lots of digging, I finally got incoming-email-to-list functionality working in MOSS. Take a look at Steve Smith's excellent tutorial on getting things set up here . I had several issues during my setup, but here are the highlights: Get things configured first using a machine-name/sub-domain first (i.e. use email@servername.company.com instead of email@company.com) The MS least-privilege configuration doesn't apply here - each web application with lists that you want to be email-enabled must use the same app-pool identity as Central Administration (i.e. the "farm account" ). Note that you can (and should) still have separate app-pools, but they have to run using the same identity. Don't forget to delegate control to the app-pool identity for making changes in AD. After getting frustrated I just granted full-control to the OU and then went back later and fixed it. Make sure the Sharepoint Timer service is running, otherwise the emails will just sit in the ...

Create Custom Applications Pages

At some point, in your WSS or MOSS customization and development process, you'll likely need to create a Custom Application pages. Custom application pages differ from site pages in that they are compiled and not customizable by the user. (to learn more about application pages click here ). If you'd like another good sample project to work off of, check out the CustomApplicationPages download Ted Pattison Group's download section. I'd also like to point out that Ted covers the specifics of this download in his book Inside Microsoft Windows SharePoint Services 3.0 which you can purchase in our SharePointers store .

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.

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.

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

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 0...

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

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.

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 [www.jjfblog.com] 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 Open Central Administration Click on the “Operations” Tab Click on the “Alternate access mappings” link under the “Global Configuration” heading 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...

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.

CSS Stub for common Sharepoint 2007 and WSS v3 styles

After taking a look at Heather Solomon's awesome CSS Reference Chart for Sharepoint 2007 (with illustrations!), I though it would be a good idea to translate her hard work into a stubbed CSS document for use in my projects. Keep in mind that I haven't verified whether all of her styles actually do what they claim to do. I simply converted the table into a usable stylesheet. All you need to do is just fill in your custom style elements. You can download the the stylesheet here [.css] or here [.pdf].

ERROR: Failed to create feature receiver...

I was working on a STSDev project which deployed a feature with a feature receiver. I had the feature working without the FeatureReceiver but as soon as I added the FeatureReceiver related attributes to my <Feature> element I got the following error: Failed to create feature receiver object from assembly "Org.Project.Solution, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c632353d405b3209", type "Org.Project.Solution.MyFeature.FeatureReceiver" for feature 6a9b2358-ea4e-486d-a4e4-4f813c52ce88: System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() After much digging around I discovered that STSDEV's Solution config file refers to a namespace as well as the dll. My FeatureReceiver's namespace was not prefixed with the right namespace So just...

SharePoint Features & Scopes Explained

This is a very good resource to use when defining your features and trying to understand what scope each one should be at: http://weblogs.asp.net/soever/archive/2007/05/03/sharepoint-features-elements-scope-and-other-info.aspx

STSDev & VSeWSS - "dogs and cats, living together"

Both STSDEV and VSeWSS are very useful tools that, in their own way, give you more simplified elegant development. STSDEV is great in that it gives you a clean, class library project structure so that you have lots of control over your project. VSeWSS on the other hand is a customized solution template that allows you to automatically add in all the necessary files for common WSS elements (lists, content types, etc). I really like the ease of using VSeWSS, but I prefer the project structure of STSDEV. My solution is quite simple. Create your Solution with STSDEV (I usually start with a Empty C# solution with assembly) and then add in a VSeWSS project once you have the STSDEV generated solution open. I basically just use the VSeWSS project as a file generator and once the files are created, I copy them over to the STSDEV project and begin customization from there. The only thing you really have to remember is to copy the Attributes.cs file from the Properties folder in the VSeWS...

STSDev 1.3 Released

I was in the process of blogging about creating workflow features in STSDEV (1.2) when I realized that STSDEV 1.3 is now released! I'm going to redo my post using STSDEV 1.3 to see if it simplifies things.

Getting Rid of Errors When Using WordPrint from the InfoPath SDK

I've been messing around with the WordPrint utility and when I reinstalled it I was getting a cryptic error: Runtime Error! Program: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. When you first start using WordPrint, copy the following files to your %Windows%\system32 directory : %Program Files%\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\WordPrint\WordPrint.dll %Program Files%\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\WordPrint\ImageDecode.dll %Program Files%\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Tools\html2xhtml.dll Then run the regsvr32 on each of these .dll's from the system32 directory.

Label Cloud

This has nothing to do with SharePoint but I thought it was pretty cool. Here's how I got the Label Cloud working on blogger.

Creating a Publishing Page Layout

This next tutorial will show you how to create a page layout. I have to admit that the bulk of the content of this tutorial comes from a tutorial written here , however, there are a few errors in the example code provided and also STSDEV requires a few minor changes as well to get everything working. In addition, I'll try to elaborate on a few more things so that you get a better understanding. Now let's dig in. Introduction If you have no experience with page layouts (and Master Pages), I suggest you read the Page Layouts and Master Pages page on MSDN . In short, page layouts allow you to customize the layout and appearance of content and web parts of pages within a MOSS publishing site. These pages are stored in a special Master Page and Page Layouts document library. Pages that are based off these Page Layouts will be stored in a 'Pages' document library at the root of the site. The nice thing about using the publishing infrastructure is that it lets you sav...

A quick tip for Page Layouts with STSDEV

I plan to write a start to finish tutorial on using STSDEV to create a simple page layout and feature receiver, but I don't have the time to do it right now and I wanted to share this tip: When you are creating a feature that contains a page layout and you want that page layout to be copied over to your server, ensure you include the .aspx page as an <ElementFile> element into your feature.xml file. If you are hand writing your own manifest, you don't have to do it, but if you want STSDEV to do it for you you'll need this element.

Debugging Your Assemblies Generated from STSDEV

If you've gotten sufficiently comfortable generating solutions with STSDEV, you've probably found that debugging doesn't seem to work. The reason is because the DebugBuild configuration is the only configuration that includes Debug code. Here's how to set up your project so that you can debug the other builds: Go to your Project Properties, click the 'Build' tab and turn on 'Define DEBUG Constant' and 'Define TRACE Constant'. Then click on the 'Advanced' button at the bottom of the Build configuration screen and change the 'Debug Output' value to 'full'. This tip came from the STSDEV discussion forum .

IIS Settings for WSS/MOSS

One of our Server Admins was asking about IIS settings to optimize WSS/MOSS performance. This blog posting is a pretty good starting place, as it gives pretty good descriptions for the settings that MOSS installation/configuration doesn't take care of for you.

Adding a custom content type to a site definition

Today we'll be a adding a custom content type to our site definition we created in this post . The project that we're working with is an STSDEV project, so my project file structure reflects that. If you aren't using STSDEV you may need to make a few modifications. If you don't know what custom content types are, here's a good overview . The content type we develop here will extend the Document content type. We'll call it a Project Proposal. Now let's get to work. Step 1: Project Set up Aside from basing this project on the site definiton I created earlier, we'll need to add the Feature folders that reflect the structure on the server. Right click on the TEMPLATE folder in your project and choose 'Add New Folder', name this folder 'FEATURES'. Then add a folder under 'FEATURES' called 'ProjectProposalContentTypes'. Step 2: The feature definition file Since we want to deploy this as a feature we'll need to create the fe...

Creating and Deploying a Custom Master Page with STSDev

This is my second post on creating SharePoint solutions the easy way, with STSDEV. This time around I'll be enhancing my last post's project by adding a custom master page. This master page will start by using a base master page from Heather Solomon's site . If you don't already have it, download it. The base master page simply gives you a stripped down master page that you can enhance. We'll actually do some enhancements to give a taste of the power that you have over the UI when you choose to customize a master page. Step 1: Add the base master page to the project If you haven't already done so, download and unzip the base master page from Heather Solomon's site. Right click on your 'RootFiles\TEMPLATE\SiteTemplates\YourSiteTemplateName' directory and choose 'Add Existing Item' Select the base master page from your file system and click 'Add' Rename the file 'SharePointersDemoCustom.master'. Step 2: Editing the Defa...

Deleting sites that were created with errors

This post will have something to do with my next post... When you are creating site definitions and deploying them via a solution, you may successfully deploy them and then find out there is a problem with them upon creation, i.e. you get an error message when creating a site using the definition through the UI. After the error occurs, the site may actually have been created, but does not show up in your navigation bar and the root of the site will be inaccessible. Interestingly enough, you can still get to the site's settings page by going to: http://serverName/siteName/_layouts/settings.aspx You can then delete the broken site from there.

Using STSDEV to create a solution with a Site Definition

In this post I'll give a basic overview of how to create a simple site definition using STSDEV. The purpose of using STSDEV is to give the project a standardized structure and to make use of the solution autogeneration. Here are the steps (Make sure you've downloaded STSDEV and run through the tutorials , or understanding this might be tough) Part 1: Generate the STSDEV solution Open Visual Studio and run STSDEV (should be an option on your tools menu if you ran through the tutorials, see above link) Choose to create an empty solution with C# assembly Click 'Create the Solution' After you create the solution, you'll need to open it from the file system. STSDEV does not automatically open it for you in Visual Studio. Part 2: Set up the project structure Even the most basic site definition needs at least 3 files: a webtemp.xml file, an onet.xml file, and a default.aspx file. So let's create these files in the appropriate places. right click on the 'Root...

Security issue when calling a WCF service from SharePoint

I've recently been charged with integrating several WCF services into SharePoint and it's been relatively smooth sailing up until I began to receive the following exception: "The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate......." My endpoint configuration originally looked like so: <endpoint address="http://myserver/Services/BackOfficeService/basic" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IBackOfficeService" contract="BackOfficeService.IBackOfficeService" name="BasicHttpBinding_IBackOfficeService" /> Looks ok, right? Wrong! We are missing the 'identity' child of the endpoint element. So, to correct this issue, the final product should look like this: <endpoint address="http://myserver/Services/BackOfficeService/basic" ...

STSDEV is pretty awesome, but...

I've begun using STSDEV as the start for my projects instead of VSeWSS. I like the simplicity of it, especially as Ted Pattison says in his first of three screencasts that you can load it into any installation of Visual Studio (that corresponds to the project type you created) because you don't rely on Add-ins/Extensions. After running through the screencasts, I decided it was time to do the solution release build and I ran into immediate trouble with a "ERROR: Could not find file DeploymentFiles\SoulutionPackage.ddf ..." error message in the Output Window. The solution, found on the STSDEV discussion board , is as follows: Modify the "ReleaseBuild" target in the DeploymentFiles\Microsoft.SharePoint.targets file as below (fix highlighted in bold red ): <target name="ReleaseBuild"> <message text="Deleting Pacakge File..." importance="high"> <delete files="$(ProjectDeploymentFilesFolder)\$(PackageFile)...

ASP.Net AJAX and SharePoint

There's a project on CodePlex that integrates ASP.Net AJAX with SharePoint: I've only read the overview, but I've had lots of projects that I've wanted to use AJAX with SharePoint. So I can see how this will be a tremendous help. http://www.codeplex.com/sharepointajax

Programmatically get SPList items from a SPView

Another tip that you're sure to find some use for: Because SharePoint list (SPList) views (SPView) don't contain SPListItems or SPListItemCollections, if you want to programmatically retrieve list items from a list in the order specified by a view you've created you have to do it as follows (I've ommited, try-catch blocks and extraneous code to give you just the bare necessities) SPListItemCollection coll = spWeb.Lists["ListName"].GetItems(spWebInstance.Lists["ListName"].Views["ViewName"]); where spWeb is a SPWeb you've opened up from an SPSite object. and "ListName" and "ViewName" are the names of your lists and views, respectively.

Quick Reference for SharePoint Built in Fields

There are many instances where you need a quick, readable reference giving you the GUIDs for your FieldRef's in a content type definition file. Here's a handy xslt stylesheet that does the transform for you: <?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wss="http://schemas.microsoft.com/sharepoint/"> <xsl:output method="html" version="1.0" encoding="utf-8" indent="yes" /> <xsl:template match="wss:Elements"> <html> <body> <h2>SharePoint 2007 Built-In Fields</h2> <table border="1" width="100%" style="font-size:10pt;"> <tr bgcolor="#9acd32"> <th align="left">Group</th> <th align="left" width="100">Field</th> <th align=...