May 2008 Entries
A common request is to create custom user profile properties to store information about users, this is something I will covered in my previous post. This is helpful when viewing their profile but if this is an important piece of information then it is possible you may need to include this in the search results for the people search and this is what I shall be covering today. In this example my property is called 'TestProperty', see below.



Next I have populated my user profile to contain some test information for this property, see below



Next you have to set up a new 'Managed Property' that relates to our new user profile property. To do this navigate to your shared service provider then select 'Search Settings'. Once in the search settings section click 'Metadata property mappings' this will then give you a list of all the existing properties. To create a new managed property click 'New Managed Property' in the toolbar. Enter the name, description, select the type of information it has to hold, this should match what you selected for the user property. The most important section on this page is the mapping property as this decides what crawled property your managed property is associated with. In this case I am mapping my new managed property to my user profile property, see below.






Once you have set up the new Managed Property you need to perform a full crawl to make sure the test data entered is picked up by the search results. Once the full crawl is finished you can check that the new property has information in it by clicking on 'Managed Properties' and then clicking on your newly created managed property and you should see in the 'Content using this property' section it will have the number of items using this property, see below.



Now we have the property with the data the next step is to adjust the search results to pull out the new property. In this example I will edit the people search core results web part but the same principle applies to any of the search web parts. First navigate to the people search results page and open the people search core results webpart editor. Second, expand the 'Results Query Option' and click in the 'selected columns' textbox. Once you have done this a button with three dots will appear on the right hand side of the textbox if you click on that it will open an editor with a list of all the columns that are available to be used to display information in the webpart, I find it easier to copy the content and paste it into visual studio but similarly you can used notepad or even edit it in the editor. Where ever you choose to edit the columns you need to copy one of the existing columns and replace the name with your own name, for some reason I could only get this to work if the name is ALL in capitals, see below.



The final step is to edit the XSL that is used to render the generated XML. To do this click on 'XSL Editor' under the 'Data View Properties' section. You can place the information anywhere you want but for this example I shall add it next to the other office profile information. The first step is to add the new property as a parameter to the 'DisplayOfficeProfile' again the name of the property must be capitalised for this to work, see below.



The final step is to change the 'DisplayOfficeProfile' template to include this new parameter and display the information. The screenshot below shows what the new template looks like.



If you now save the editor, save and close the web then publish the page if you perform another search you should see the information appear in the webpart. One thing i have noticed is sometimes when you make a change to the webpart and click 'OK' it will look like the webpart is throwing an error. I'm not sure why this is but if you publish the page and perform another search it works ok.

Hope this help.

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
Setting up the built in usage reports is an important step when configuring your web farm but it is something that can be easily missed. There are two different sets of reports you can use to anaylse the usage of your farm they are:
  • Site Usage Reports - These reports are used to analyse an individual site.
  • Site Collection Usage Summary - These reports are used to analyse the site collection as a whole.
Both of these contain some similar statics on Requests, Users, Referrers, Destination Pages and Home Page that can be used to provide an insight into how both individual sites and the site collection is being access. The Site Collection Usage Summary also has some reports showing Search queries and Search results that again can help helpful in configuring your search settings to make it as easy as possible for user to find the information they are looking for.

You can check if these reports are enabled by navigating to site settings and clicking on either one of the links. If the page looks like the example below then you still need to configure the farm.



To enable these reports there are two settings in central admin which you have to enable they are:
  • Usage Analysis Processing
  • Usage Reporting
To enable Usage Analysis Processing navigate to the 'Operations' tab, next click on 'Usage analysis processing' located under 'Logging and Reporting', see below.



Next check both 'Enable Logging' and 'Enable usage analysis processing'. At this point you have two important considerations first which location you want to store your log files and second what time you want to run the processing at., see example below.


Considering the log locations first it is generally accepted that as most MOSS 2007 log files can grow to significant sizes you should move them to another drive. I would follow this best practice and set the location to another drive which has additional space available. The next consideration is the time you want to run the processing at and again best practice dictates that these type of tasks should be done when the site is not being used. So with this in mind I usually set the time to the early hours of the morning. Once you are happy with these setting we need to move on to configuring the Usage reporting.

You can find the Usage reporting in the setting for your Shared Service Provider under 'Office SharePoint Usage Reporting'.



To enable this all you have to do is check both 'Enable advanced usage analysis processing' and ' Enable search query logging'.



If you now navigate to either the Site usage summary or the Site collection usage summary you should see it now displays the reports. When you first view the reports most likely they will be blank, as below, this is because it only starts capturing the data once we have enabled the usage logging and we also have to wait until the analysis processing has been completed.



If you check the after the processing has been done you should see the reports will now contain data.

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
Does anyone know if there is a way in MOSS 2007 to create a threaded view similar to the 2003 version with '+' and '-' to expand and collapse Discussions, see image below for example?

Discussion Boards in SharePoint 2003

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist

During one of our recent projects we had a site, which contained multiple sites each several document libraries some of which were based on a custom list definition. During testing we noticed that all the document libraries based on our definition had 'Allow management of content types' set to no, which was a problem as we had create several content types that were to be used across the site. After some discussion we decided that there were two options:

  • Manually set each document library.
  • Write a custom application to do it for us.

Given the size of the site and the time involved in setting each document library we decided that the best approach was to write a custom application to do this for us and this is what I shall be looking at today.

My application was designed to only be used by my self or other developers and was for a very specific purpose, therefore was fairly basic but you could extract some of the settings from the actual code and create a generic application that could be tailored to extract a collection of any type of list or library across a site collection.

The first problem I encountered was that while trying to run the application i didn't have appropriate permission so in order to get around this I used the RunWithElevatedPrivileges method to prevent this. The important part of this section is you must open the web before running the code with elevated permissions otherwise you will still encounter problems.



Now that we have the correct permission to access the site via the API I could then connect to the chosen site, specified via a textbox on the application, and iterate through the sites to find the selection of document libraries that match my criteria. The first step in achieving this is to open the SPWeb object again this time with the higher level of permissions and make sure there are webs within the site collection. Next I iterated through the list of SPWebs in the collection and then for each SPWeb called a separated method that looked at all the lists within that site.



The IterateThroughLists method is the one that performs the check to see if any of the document libraries in the given site matches the criteria I’m looking for and if it does set 'Allow management of content types' set to true. The first step is to get the collection of lists within the site and then iterate through the lists. Next I examine each item in the list collection and compare them against my criteria. In this example I am looking for document libraries based on my custom definition so I know that the base type must be 'Document Library' and I also know that the document libraries I’m looking for have certain TemplateFeatureId so I can match this against a specific GUID, set as a constant. Finally I check to see if the document library already has 'Allow management of content types' set to true if it does then i can ignore it otherwise set it to true.



One key thing that cause me some problems was not calling the Update method as without this the code makes the changes but does not save them. So even though you can debug through the code and watch it set 'Allow management of content types'  to true if you don't call the update method when you then look at the document library it will still say 'Allow management of content types' is set to no . I hope you found this useful and can see how easily it can be changed to look across sites and generate collections of lists given certain criteria.


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
One of the most common and potentially one of most important tasks in a MOSS 2007 project is styling the site to match the clients branding. Our preferred method for doing this is to create a new theme and then to staple this to our custom site template. I will cover creating a custom site definition in a separate post, my main focus today is creating a new theme.

The first step in creating your new theme is to copy an existing theme folder, can be found at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES, and re-name it. For the purposes of this example i have named mine 'NEWTHEME'.

  THEME
Next open the folder and re-name the .INF file to match the name of your folder. In this example i copied the Classic theme so changed CLASSIC.INF to NEWTHEME.INF. In addition in the NEWTHEME.INF file you have to change all references from Classic to NEWTHEME.

THEME

Once you have created the new folder for your theme and re-named all references the next step is to add your theme into the list of available themes. To do this we have to add in an entry into SPTHEMES.xml, can be found at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033. Again the best option is to copy one of the existing 'Templates' nodes and re-name it to match your theme name.

THEME

If you now try and change the theme of an existing site you will now see your option.



Following these easy steps will allow you to quickly set up a new theme and change the styling of your site. In my next post i will show you have to create a custom site definition that uses a feature to bind the theme created in this example to all sites created in based on our new custom site definition.

Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist