Display updated items

The Content Query Web Part is really nice but leaves some wanted functions like:

* Display updated items for a specific time period
* Be able to display items from several lists and libraries (why not all?)

* It would be nice if you could filter your latest updates so that it does not show an item from the year 2007 just because that is the latest updated item. You should be able to set a filter that tells the webpart to display only items that are [Modified]+7 or something similar. As it is now, you have to create such a field in your list and display that certain field (I did this, look further down in this post).

* I would like to pick any field from my lists and display them and sort them in the webpart. Only fields that are created as Site Column are in the list now.

* You may group your latest updates and that is nice, I usually group them after Site. BUT, if you only want to show the latest 10-15 updated items – and you have like 5 updated items on one site – then it only shows 15 rows and that mean that I can’t see the other sites updates because of the row limit. It would have been nice to display the ONE latest update from all the sites.

One solution I have used to display only the latest weeks updates is to do this:

Create a new column. Important: you must create it as a Site Column! Or else you will not find it in the Content Query Web Part!
Enter a name that tells the user that this is a “system” field with a name like “ShowUntil” and select “Date and Time” as the type of column.

Date and Time Format is set to “Date Only”.

Then set the default value to a calculated value. Add “=Today + 7”.

Clear the Add to default view check box.

Save the new column.

Add your new column to the document library or list you want to display updates from.

Now in your Content Query Web Part, select the column you created and set the filter to display it if it’s “Greater than or Equal to” [Today] to your column:

Now when the list is updated on a site, it will be displayed in your web part for seven days from the created date.

Share this blog post:

Notepad ++

Get it today! A really really helpful extension of Notepad. Things you have been longing for πŸ™‚ The simplicity of Notepad but extended with functions like comparison (love it), intellisense (just select the code language you are using and it will color the tags…), line number etc etc. Lovely!! Get it here:

Happy coding πŸ™‚

Share this blog post:

Change the “Sign in” text

If you want to change the “Sign in” link text on a Sharepoint page, then do this:

Open the beloved folder C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATECONTROLTEMPLATES

Open “Welcome.ascx” and go to the end of the file
Change the tag:

SharePoint:ApplicationPageLink runat=”server” id=”ExplicitLogin”
ApplicationPageFileName=”Authenticate.aspx” AppendCurrentPageUrl=true
Text=”<%$Resources:wss,login_pagetitle%>” style=”display:none” Visible=”false” />

to this:

SharePoint:ApplicationPageLink runat=”server” id=”ExplicitLogin”
ApplicationPageFileName=”Authenticate.aspx” AppendCurrentPageUrl=true
Text=”Your text here” style=”display:none” Visible=”false” />

Share this blog post:

Stylesheets that are used in MOSS

I do a lot of CSS changes to my sites, I find that easier and quicker than to rebuild themes or site definitions and stuff.

MOSS 2007 uses the following css files:


When you create a WSS site, the following CSS files are used:




Share this blog post:

Anonymous access with Publishing portal

When you activate anonymous access on a site and you would like your anonymous users to be able to publish an item to a list, then you cannot use the template “Publishing portal”. Why? Don’t know! You must use the template “Team Site” for this to work! I noticed this when I had activated anonymous access but never got rid of the login-prompt! So.. I created a new site and used the template “TeamSite” and enabled anonymous access on it, then voila – an anonymous user was able to post an item to my list without being prompted with the login! Strange….

Share this blog post:

Dropdown with URL in onchange

If you want to create a dropdown list with onchange event to dynamically go to selected URL then do this:

Use Sharepoint Designer
Insert Data View
Select Show Data
Select which field that should be displayed in the drop-down list
Insert Data
Change layout to β€œDrop-down view style”
Click OK
Change to Code view in Designer
Put the following code before the /head> tag:

script language=”JavaScript”>


Then find the following in your code
select name=”ID” size=”1″12
Change that to
select name=”ID” size=”1″ onchange=”FP_jumpMenu(this,’window’,false)”>

Then find
option style=”display:{$GroupStyle}”
Change to
option style=”display:{$GroupStyle}” value=”{@FieldWithURL}”>
where FieldWithURL is the link that you want to go to

Share this blog post:

Deactivate the name.dll active x control

Websites built on SharePoint 2007 prompts you to install Microsoft’s Name.dll ActiveX control on every page load of your SharePoint web site. Name.dll provides “presence” functionality, that is if you have Messenger it will display your online status. This is annoying, I think anyway πŸ™‚

To remove the prompt on a site you have to do the following:

Go to the folder (the one and ONLY folder as a Sharepoint developer/administrator…)

“C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATELAYOUTS”

If you don’t want this to affect all of your websites (it is a really useful function on your intranet for example) so create a new folder on your server and copy the contents of the “LAYOUTS” folder to a new folder. Let’s ensure SharePoint will have permission to access the files. Through Explorer, open the properties for your newly created folder and under the security tab add the “WSS_WPG” account (the default Read & Execute, List, and Read permissions are enough) and let’s add the WSS_ADMIN_WPG account with full permissions (see image below). In the IIS Manager Console, open the properties for the “_layouts” virtual directory (under the web site you want to modify) and change the local path directory to your newly created folder. Test your Web Site and make sure everything is working.

The ActiveX feature is in a script file called INIT.JS located in the LAYOUTS1033 folder.

Go to the function called EnsureIMNControl()
Comment out the ActiveXObject line:
//IMNControlObj=new ActiveXObject(“Name.NameCtrl.1”);

After applying any updates or service packs to SharePoint you’ll probably want to reverse this customization and perform these steps again after the update to ensure your web site is running on the latest code.
function EnsureIMNControl()
if (!bIMNControlInited)
if (browseris.ie5up && browseris.win32)
//@if (@_jscript_version >=5)
//@ try
//@ {
//@ //IMNControlObj=new ActiveXObject(“Name.NameCtrl.1”);
//@ } catch(e)
//@ {
//@ };
if (IMNControlObj)
return IMNControlObj;

Share this blog post:

Hide items from users

You can hide some functions from users on a page in Sharepoint by adding the “security trimming control” – it’s really useful. For example, the “Site Actions”-button should be hidden from anonymous users.

Put the following tag around the Site Action control:

Sharepoint:SPSecurityTrimmedControl runat=”server” PermissionsString=”BrowseDirectories”>
[Site Actions content holder here]


This permission string used the “BrowseDirectories” which is a very low level of permission. You can also use “AddItems” and so on, to allow users that has EditItems to see the SiteAction button but hide it from those who can Add items.

Share this blog post: