Browse by Tags

All Tags » development (RSS)

Vital Hotfix for Sluggish Design View in Visual Studio 2008

Microsoft has released a Hotfix for the incredibly annoying performance issues when working in the Design view of an Asp.Net form that contained custom user controls. The installation info is on the MSDN Blog and is pretty self explanatory.  It takes a few minutes to install but it is worth the wait.  Before the patch, simply switching to Design view for one of my Asp.Net forms could take upwards of 30 seconds.  After the patch, it takes around 3 seconds and half of that is the pulling together the nested master pages behind the form.  I've also noticed that the properties window now switches almost immediately when I click on a control.  Before, it would take 5-10 seconds to change and sometimes never did. Posted on SharePoint Blogs Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under:

The Battle for Nothing... or is it Null?

I have worked in numerous programming languages and the one thing that I find most irritating is that every language feels the need to reinvent Nothing - literally - and then applies their own rules to it. In VB, Nothing is Nothing .  In C# and JavaScript, Nothing is null .  Ruby's Nothing is nil .  Nothing can also be Null or Empty or undefined , although it can sometimes be NaN , which is not necessarily Empty or Null .  Something that is undefined is sometimes null and sometimes not but something that is null is rarely undefined . Throw in the mix how badly empty strings are handled where "" is not Empty or null , but is an EmptyString and could be NaN .  It could also be a NullString , which is still not a null or even a Null and certainly not an Empty or undefined . Nothing/Null/null/nul/nil is a basic part of any programming language.  Is there any chance that we could pick one term, like Null (or null even), and use it across languages? It's just a word, what is the big deal?  The word itself is trivial but the need to use a new term for something so basic is the root of my aggravation.  Each language feels that they have to use their own terms to be "cool", yet are just rebranding well established concepts without adding functionality.  That isn't innovation, that's marketing.  It's "New and Improved" without being either. All it accomplishes is that it adds one more tiny...
Posted by SharePoint Blogs
Filed under:

Build fix queries in a dynamic way

By default, we are able to display query results in our own page with the Search Core Results web part . Basically the search query can be built in two ways: UserQuery: to get a query from current user we need a Search Box or Advanced Search Box web part. After typing the query, both of these webparts give the query to the URL QueryString, and the Search Core Results webpart show the results according to these parameters. For example: http://mymoss/sites/customsearch/default.aspx?k=42 means the user...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Enable Workflow development in a class library project being used to create a WSSv3 Solution

When creating a WSP in WSSv3, the common development practice is to create a project in Visual Studio using the Class Library project template. The problem with this is that none of the Workflow item templates are present when you try and add a new item, so how can you add a Workflow without having a one-off Visual Studio project just for your Workflow Feature? The answer is that you need to make some changes to the project file in Visual Studio to make it happen. The project file ( YourProject.csproj...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Using SPWeb.EnsureUser(loginName) to add a new SPUser to a web

It happens quite often that I have to write a piece of code to set user permissions on a SharePoint site. One of the challenges you encounter when doing so is that you need to have a valid SPUser object, that is known in the site collection to be able to do this. If you want to create a new subsite or web you can start out like this: // Open an existing site collection SPSite portalSite = new SPSite(" http://portal "); // Create a new subsite (web) SPWeb newWeb = portalSite.AllWebs.Add(" http://portal/newweb ", "My New WebSite", "This is my new web site", 1033, "STS#0", true, false); // Get the default roledefinitions known on the new web SPRoleDefinitionCollection roleDefinitions = newWeb.RoleDefinitions; // Get the roleassignments collections of the new web SPRoleAssignmentCollection roleAssignments = newWeb.RoleAssignments; Next you want to get an SPUser object, so you can give this person the right permissions on the site. Unfortunately there is no way of telling whether you can get this user from the site collection. If the user is known on the site collection there are three ways to get it: SPUserCollection users = portalSite.RootWeb.AllUsers; The description in the SDK for this function is: "Gets the collection of user objects that represents all users who are either members of the site or who have browsed to the site as authenticated members of a domain group in the site." This means that if you have a site collection...
Posted by SharePoint Blogs
Filed under: ,

Send email from MOSS using Outbound Email settings in Central Administration

Being Asp.Net developers, we all know we can send email from within custom code using the virtual SMPT server running on the Web Front End server where our code is running, but what if you want to use the same SMTP/Exchange settings you configured in Central Administration? Luckily, there's a way to do so. I like to create an object I call SPEmail for encapsulation, then within the Send method go dig for the info I need from the SPAdministrationWebApplication.Local and it's OutboundMailServerInstance...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Free SharePoint eLearning classes available from Microsoft

Please note that these classes are not completely targeted at SharePoint end users, but if you're at all curious about how to get started building your own custom web parts or applications using SharePoint these are worth taking a look at. My experience with these courses in the past is that they are a good way to introduce you to some of the tools and concepts involved in SharePoint development. You shouldn't expect to be a fully proficient developer after completing the courses, but you'll have your feet wet and you can't beat the price. One thing I've noticed with the SharePoint end user experience is that once people get comfortable in the environment, their thoughts often turn to how they can customize their sites and tune them to meet their specific needs. That often leads to some gnashing of teeth when they come up against limitations of the platform out of the box. The great thing about the latest versions of SharePoint is that its much easier to develop against, but the learning curve is still pretty steep. If you're an experienced SharePoint developer, I highly doubt there's going to be any great revelations for you in this training. However, if you're a new or novice developer, definitely check them out. Clinic 5045: Inside Look at Developing with Microsoft® Windows® SharePoint® Services 3.0 Clinic 5046: Inside Look at Building and Developing Solutions with Microsoft® Office SharePoint® Server 2007 Posted on SharePoint Blogs Del.icio...
Posted by SharePoint Blogs
Filed under: , , ,

Get/Set custom profile properties in Profile Provider for MOSS

I'm working on a site which uses Forms Based Authentication, and I want to extend the standard user profile with some of my own custom properties. I knew you could define a ProfileProvider in the MOSS web.config file, but the tricky part was getting and setting the values since the framework is unaware of the provider. You can't access the properties at design-time like a normal Asp.Net Web Application, and I couldn't find any documentation for accessing Profile Provider Properties as...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Operation is not valid due to the current state of the object

Operation is not valid due to the current state of the object This is one of the common errors that you see during SharePoint development. There could be many reasons for this error to occur. Here I will discuss one scenario. I have noticed that sometimes calling SPContext throws this error. It seems to be a bug. The code works for the first time but throws an error if you run the same statement again (during the same session). For example, consider the following code: SPSecurity .RunWithElevatedPrivileges...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Modify the inherited properties of a field

One of my collegues find a very interesting thing in the SharePoint: It's forbidden to modify the inherited field's properties (for example AllowMultipleValues defined by SPFieldLookup class) via properties! Doing this you start a back process, and the SharePoint donesn't use the field class anymore, but the fields will be created from the root class. Why? - That's a good question. Most likely because it's not supported. So you can modify the properties defined in the root class...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

A nice blog post on Debugging in the GAC

I just came across this nice article and thought I will share it. You Don't Need to Copy PDB Files to Debug in the GAC! -Guru Mirrored on SharePoint Blogs Posted on SharePoint Blogs...( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under:

Setting item level security in an eventhandler

Last week I was building a solution for a customer that involved setting item level security on a document in a document library the moment it is added to the document library. I'm not a big fan of item level security, because it can create chaos from a maintenance perspective, but sometimes it's simply the best, or even the only solution. I started out be creating the feature that will contain the eventhandler. The Feature.xml is very straightforward: <Feature Scope="Web" Title="Set Security Eventhandler" Id="7B2CB0DC-8F27-4252-A4F2-89729DF9331B" xmlns=" http://schemas.microsoft.com/sharepoint/ "> <ElementManifests> <ElementManifest Location="Elements.xml"/> </ElementManifests> </Feature> The Elements.xml looks like this: <Elements xmlns=" http://schemas.microsoft.com/sharepoint/ "> <Receivers ListTemplateId="101"> <Receiver> <Name>AddedEventHandler</Name> <Type>ItemAdded</Type> <SequenceNumber>10000</SequenceNumber> <Assembly>Macaw.Custom.Moss2007.Portal.Business.Components, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6bdc41c2016ac3e3</Assembly> <Class>Macaw.Custom.Moss2007.Portal.Business.Components.SetSecurityEventHandler</Class> <Data></Data> <Filter></Filter> </Receiver> </Receivers> </Elements> So you can see that I created an eventhandler that...
Posted by SharePoint Blogs

How to deal with URL fields in SharePoint Lists programmatically

What seems to be a simple task has very little examples on the web. This is how: //Assuming You have an SPWeb object called "web" SPList list = web.Lists[ "YourList" ]; //Get a list SPListItem item = list.Items[0]; //Get an item item Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

SharePoint navigation highlighting - Download project files

A while ago I have posted a tutorial about how to make SharePoint's navigation highlighting to be more relevant. ( link to the post ) The download link for my sample project was broken, so thanks to some feedback from you I have fixed it. Here is Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

SharePoint Wiki: Create pages based on a template

Creating Wiki-Pages from a Template To make Wiki pages look uniform, it would be handy if there was always the same template used when the pages are created. Unfortunately, WSS 3.0/MOSS 2007 doesn’t support this functionality (yet). The below paragraphs show the concept on how to achieve this functionality. Neither the code nor the configuration steps described are suitable for a production environment – they are just the proof-of-concept that it is possible. Adopt it freely! The configuration part 1. Create a WIKI site 2. Create a Custom List called something like “Page Templates” 3. Add a custom column “Template” and make it multi-line rich-text including pictures etc. 4. Now create your HTML Template. 5. Copy your HTML (only the part inside the <body> of course) and add an entry in your custom list. In my example, the title is “Wikipedia” and in the “Template Column” switch to HTML view and paste your HTML Teplate 6. If your template needs a separate stylesheet, you must proceed like with any other stylesheet in MOSS (and make sure it doesn’t interfere with the standard styles so your layout gets corrupted…): a. Upload the style sheet to the appropriate location in the Styles Library b. Add a link to the style-sheet to the master page (Example: <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/wikipedia_common.css %>" runat="server"/> ) The development part Before I show the development steps this warning: This is...
More Posts Next page »