Posts

Showing posts with the label features

The magical AfricanPith

I was having a problem where my images in a folder in my RootFiles\Template\Layout\[ProjectName] directory of a feature solution were not being added to my wsp (or .cab) file when I did a build. After much headscratching I have found that the headscratchingly strange solution is that you need to keep the AfricanPith image in there. If I can figure out why this is, from looking at the code, I'll post the code fix.

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

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

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

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

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.

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

Luke, don't use the '-force' (when reinstalling features)

Just a quick post to document a problem that I was having. I was refreshing my memory on Event receivers and was following this tutorial: http://www.wrox.com/WileyCDA/Section/id-306329.html The only difference between my code and the example was that I put in a comment (<!--like this-->) between the <Receivers> opening tag and the <Receiver> opening tag just to document something....well, SP doesn't like this at all and I got this error: Cannot insert the value NULL into column 'Name', table 'WSS_Content_Portal.dbo.EventReceivers'; column does not allow nulls. INSERT fails. The statement has been terminated. So I took out the comment and reran the install and activate commands (from the command line) and everything worked fine...or so it said (I got the operation completed successfully), message. However when trying to test the sample (after activating), I created a new announcements list and got an error. I checked the logs and lo and behold, the...