Filter The Content Query Web Part by file type and display file size.

Today I had to configure a Content Query WebPart to display the most recent modified documents and their file size. An easy task which I had quickly completed by reading two blogposts:

Filter CQWP by File Type:

  1. Insert a CQWP to a page and configure it as you would like.
  2. Export the web part and save it as “.webpart” file on your local computer.
  3. Open the “.webpart” file in a text editor. (I use SharePoint Designer)
  4. Look for the following line:
    <property name="CommonViewFields" type="string" />
  5. Replace it with the following line:
    <property name="CommonViewFields" type="string">DocIcon,Lookup</property>
    This will make the CQWP retrieve also the DocIcon field that basically include the file extention.
  6. Look for the following line:
    <property name="AdditionalFilterFields" type="Lookup" null="true" />
  7. Replace it with the following line:
    <property name="AdditionalFilterFields" type="Lookup" >DocIcon</property>
    This will make our CQWP to allow you to filter by our newly added DocIcon field through the filtering UI in the web part’s toolpane.
  8. Save the file.
  9. Go to a sharepoint page and import the modified “.webpart” file into your page.
    http://blogs.microsoft.co.il/blogs/itaysk/archive/2008/02/26/filter-content-query-web-part-by-file-type.aspx

CQWP Filter Before and After

Display File Size:

  1. Export the .webpart file for the content query you want to have the file size.
  2. Change the CommonViewFields property in the .webpart file to look like the following:
    <property name=”CommonViewFields” type=”string”>FileSizeDisplay,Computed;File_x0020_Size,Lookup;</property>
  3. Save the .webpart file
  4. Import the .webpart file and put it on a page
  5. Add the following to the end of the itemstyle.xsl:
    <!– The size attribute for each item is prepared here –>
    <xsl:template name=”DisplaySize”>
    <xsl:param name=”size” />
    <xsl:if test=’string-length(@FileSizeDisplay) &gt; 0′>
    <xsl:if test=”number(@FileSizeDisplay) &gt; 0″>
    <xsl:choose>
    <xsl:when test=”round(@FileSizeDisplay div 1024) &lt; 1″><xsl:value-of select=”@FileSizeDisplay” /> Bytes</xsl:when>
    <xsl:when test=”round(@FileSizeDisplay div (1024 *1024)) &lt; 1″><xsl:value-of select=”round(@FileSizeDisplay div 1024)” />KB</xsl:when>
    <xsl:otherwise><xsl:value-of select=”round(@FileSizeDisplay div (1024 * 1024))”/>MB</xsl:otherwise>
    </xsl:choose>
    </xsl:if>
    </xsl:if>
    </xsl:template>
  6. Create a new style in the itemstyle.xsl and include the following where you want the file size to appear:
    <xsl:call-template name=”DisplaySize”>
    <xsl:with-param name=”size” select=”size” />
    </xsl:call-template>
  7. Select the style you added the file size to in the properties of the CQWP.
    http://blogs.officezealot.com/jrblog/archive/2008/02/21/displaying-file-size-in-a-content-query.aspx

image

All you need to know about SharePoint 2010, for end users and information workers

A good blog post about all the ins and outs of SharePoint 2010 for end users.

It will give you information about:

- Capabilities
- Clear explanation on terminology
- How to videos
- Resources
- Communities

You can find it here: http://sharepoint.microsoft.com/en-us/Pages/default.aspx

SharePoint in Plain English

Often we (SharePoint people) are asked to explain what SharePoint is, what people can do with it and perhaps most important, what SharePoint can do for people.

Well, there is a YouTube video that explains in plain English what SharePoint is and I don’t want to keep it from you.

The video:

SharePoint Server 2010 performance and capacity test results and recommendations

Microsoft has recently published some new whitepapers about the capacity impact of specific feature sets that are available in SharePoint Server 2010.

These white papers describe the performance and capacity impact of specific feature sets included in SharePoint Server 2010. These white papers include information about the performance and capacity characteristics of the feature and how it was tested by Microsoft, including:

  • Test farm characteristics
  • Test results
  • Recommendations
  • Troubleshooting performance and scalability

MySitesSocialComputingCapacityPlanningDoc.docx
260 KB
Download

OfficeWebAppsCapacityPlanningDoc.docx
236 KB
Download

SharePointServerCachesPerformance.docx
728 KB
Download

Link to the original article on www.microsoft.com

Second day at the Best Practices SharePoint Conference #BPCUK

The first day was great, we attended some interesting sessions and had a lot fun in general.

The sessions I attended today:

- This is me, is that you? Identity management in SharePoint 2010. Rick Taylor IT106
- End User Adoption – the most hijacked SharePoint Term, what does it actually mean. Steve Smith IW407
- SharePoint Search 2010 Challenges Tricks and Tips. Matthew McDermott IT/DEV308
- Creating Sites,Site Definitions,Web Templates and custom code. Mirjam Van Olst – DEV209
- SharePoint Branding – From Beginning to End. Matthew Hughes COM610
- Achieving Return of Investment with SharePoint. Brad Smith IW411

Identity management

Rick Taylor’s session was a lot of fun as usual, it’s always a great experience to attend his sessions, it was about identity management, who are you, and how do you make yourself visible. He had some interesting tips about FIM, Forefront Identity Management Server. For instance, it installs a WSS 3.0 site for management purposes. That does not mix with a SharePoint 2010 WFE so you need to install it on a dedicated server.

Next session by Steve Smith, he talked about a hyped term, user adoption. Some keywords to make his vision clear to the audience.

Define end user adoption

End user adoption is:

- Unique for each company, never the same.
- Collaboration is key
- If the SharePoint environment is visited everyday
- If forms are available, company wide
- Not about tools but people, train them to use the new business tool, SharePoint.
- When process automation is in place. Don’t make it harder, make it easier.
- Social Networking can stimulate end user adoption.
- Targeted content, make it relevant for each user.
- A portal should always be intuitive, the ease of use should be high.

Vision

To make sure that end user adoption can be handled and supported in a good way some requirements should be met up front: Start with a vision, when did a company think of its long term vision, where will they be in 10 years? Then again, a lot can happen in 10 years, it might not be what you originally planned. Don’t link vision with technology, it doesn’t work! A vision should not be a general goal.

How to achieve end user adoption

- Who will be our customers, how will we work then
- Ensure everyone is onboard, Project/ business process experts, Information Architecture experts, Power users, Technical IT Pro’s / Development, CEO’s.
- Align user needs
- Identify business processes
- Train people that are in the team
- Define measurable and achievable milestones
- Make the model flexible enough for the future
- Pilot, feedback, re-test, deploy
- Tasks should make work easier, not more complex
- Take time for a project, between half a year / 1 year
- Make sure you analyze the use of sites and pages. Measured statistics will prove adoption short and long term objectives over time
- You cannot afford to switch your users off on day 1

SharePoint Search 2010 Challenges Tricks and Tips

Third session on Tuesday by Mathew McDermott. It was a fun and good session about SharePoint search tips and tricks. Here are some keywords I wrote down during this session:

- DFS for large file storage, distribute large files to geo locations. Location matters.
- Search indexes DFS and is presented to the user as if he sees results locally.
- Dfs root indexeren. Met server name mapping de interne url van de dfs vervangen voor de dfs url zoals bekend bij de user.
- In SharePoint 2010 link lists are indexed on a smart way, if a 404 is returned it will not be in the search index.
- Server name mapping is key if you want users to directly let users to go destination from search results instead of first going to the list.
- Create scopes for different types of information returned in search center.

  • Images
    • Include rules, contenttype = image/jpeg , contenttype = image/gif etc…

    PDF

  • Excel
  • Word
    SharePoint 2010 fixes the result xsl if there is an error.

Prepopulate query suggestions lists with powershell to create a high useability from start.

Tip, a lot of good result xslt examples: http://sctxsl.codeplex.com/

So far my notes on the second day of the SharePoint Best Practices Conference, the other sessions where interesting but not very new to me therefore I do not have to much to tell about it.. At then end of day K2 organized a very fun and good party in a club downtown london, getting up today was not the easiest part of this conference. :)

Cheers!

First day at the Best Practices SharePoint Conference #BPCUK

This year we had the chance to visit London with some colleagues to attend the European Best Practices SharePoint Conference 2011. Me and 4 other colleagues got the opportunity and decided to fly early to London so we could act like real tourists

The past two days we had a great time, enjoyed the perfect weather, had some pints and we actually sat in a tour bus and visited almost every touristic spot.

Today the conference started which means, time to get serious. These sessions I have attended today:

- Executive guide to SharePoint – Brad Smith – IW401
- The discipline of Findability – Bill English – IW402
- SharePoint 2010 ECM – Extending and Maximizing SharePoint ECM for your Enterprise -  Bob Bueltmann PAR104
- Incorporating metadata into SharePoint 2010 custom solutions – Andrew Connell DEV 204
- Best Practices for achieving Enterprise content management for the masses. – Ben Robb IW405

All sessions were interesting in one way or the other, tomorrow and Wednesday I will list all sessions I attend.

Now it’s time for the SharePint event!

 

P1000264

Video: Deploy a client tool for taking SharePoint content offline

A new video is available about how to deploy SharePoint Workspace 2010 to SharePoint site contributors who work offline; that is, how to support offline uses of SharePoint sites.

Check it out here: Deploy a client tool for taking SharePoint content offline (video)

Original blog item on technet: http://bit.ly/gUC4bE

SharePoint 2010 Architectures Overview

Nice extended post on MSDN about SharePoint 2010 Architecture, lots of info there..!

http://msdn.microsoft.com/en-us/library/gg552610.aspx

Samsung Galaxy S connection with pc, MTP application keeps restarting

For private use I have a Samsung Galaxy S mobile phone that runs on Android. Since I am a guy that works in IT I every now and then check the internet for firmware upgrades for devices like these.

Yesterday I decided to upgrade the firmware on my galaxy s to a more recent version and for that the phone needs to be connected with the PC. Easy you would say.. Uhhh think again!

Samsung uses a desktop application that you need to use for synchronizing stuff between your phone and computer like, contacts, photos, videos, text messages etc.

When you want to upgrade your phone with the latest firmware, Samsung Kies is the tool your doomed too! Bedroefde emoticon

Here is what I did:

Downloaded the most recent version of “Samsung Kies” of the internet, installed it and connected my phone via USB with the computer. On the phone I then get to choose how i would like to connect it to my computer, picked “Samsung Kies” and from that point on, a screen keeps restarting on the phone called “MTP Application”. So i started to download the internet and search for a solution, cause there should always be one right?

First i tried this: http://hubpages.com/hub/How-to-Connect-Samsung-Galaxy-S-with-Kies-on-your-PC didn’t work for me.

Then i installed Samsung Kies on an old “Windows XP” virtual machine that was dusting away somewhere on the filesystem, didn’t work either. Next thing, an attempt to install Samsung Kies on a laptop, nope still not working!

I allready called with the company that sold me my phone, they told me that i should bringt it over and let them have a look. Offcourse i said ok, disconnected and had 1 more look on the internet i downloaded earlier in my post.

Yes!

Found it!

It’s easy!

Here it comes:

1.Backup youre media (Photos movies etc) Use bluetooth or USB, whatever works for you because all youre media will be erased. (Contacts, applications and sms will remain on phone. Some apps store data on sd-card though. Dont blame me if you loose something important.
2. Press the menu button and select "settings". Then go to "sd-card and phone memory"
3. Choose "uninstall sd-card" then "Format sd-card"
4. Restart youre phone

Worked for me!

Creating a SharePoint 2010 Foundation MasterPage Solution and enable inheritance with Event Receivers.

As a consultant we very often need to develop a custom SharePoint 2010 solution which incorporates the customers company branding. There are a few ways to accomplish that and I will write down my preferred method in this blog post.

As the title of the blog states, this concerns a “Foundation” MasterPage solution, this is an important fact since SharePoint 2010 foundation MasterPages behave a little bit different then, for instance, a publishing MasterPage that you can use in SharePoint 2010 standard and enterprise. Inheritance of MasterPage settings is not an option in a Foundation environment!

Ok, lets start the magic!

Environment

For development and prototyping I have my own virtual machine configured with this software:

  • Windows server 2008 R2 standard – 64 bit
  • SQL Server 2008 R2
  • SharePoint 2010
  • Visual Studio
  • SharePoint Designer

    My virtual machine is configured without Active Directory and SharePoint 2010 uses local accounts to provide all Service Applications that I need.

    Here are some good blog posting on how to do that:

    Single Server Complete Install of SharePoint 2010 using local accounts

    Managed Accounts in SharePoint 2010

    Visual studio project

    Open up Visual Studio and create a new SharePoint project:

    Make sure you select “.NET Framework 3.5” type project!
    image

    Choose to what site you want to deploy your solution during test/debugging activities:

    The choice for a sandboxed or farm solution is up to you, most of the times I choose for a farm solution. In this case I am able to deploy a look and feel solution to multiple SiteCollections at once.

    image

    That’s it, you have created a SharePoint 2010 Visual Studio project.

    Choice

    An important decision you need to make before adding your MasterPage and stylesheets to the solution is where you want to deploy all the branding files, in the SharePoint content database or the the “layouts” folder on the file system. If you are creating a MasterPage solution for SharePoint 2010, deploying to the “layouts” folder is the best choice. It has a few advantages:

  • Performance – caching is a lot better when you deploy files to the “layouts” folder, rather then to the SharePoint content database. A blog post by Waldek Mastykarz on performance in SharePoint sites:

    How we did it: mavention.nl – Part 2: Performance

  • From within SharePoint 2010 Foundation MasterPages you can easily refer to a stylesheet that is in the “layouts” folder when you are in a subsite withing a SiteCollection, the relative path is always the same. Referring to the “Style Library” in SharePoint itself is a lot harder to keep it consistent and working on subsite levels.
  • In this blog post I will be using a combination.

    MasterPage

    Next, we are adding a module for our MasterPage:

    Right click on your project in the solution explorer and choose to create a new item, module.
    image

    Once you have done that, the new module is created and also a feature has been added to provision the module to SharePoint when you deploy the solution. You can rename that feature from “Feature1” to whatever you want! In my case: “DemoBlogPost”.

    image

    Feature

    You can delete the “sample.txt” from the MasterPage module and add your own custom MasterPage. That new custom file will automatically be added to the elements.xml. In my project I add some extra properties to the elements.xml so that it is available in SharePoint in the correct way:

    1 <?xml version="1.0" encoding="utf-8"?> 2 <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 3 <Module Name="MasterPage" Url="_catalogs/masterpage"> 4 <File Path="MasterPage\demoblogpost.master" Url="demoblogpost.master" Type="GhostableInLibrary" 5 IgnoreIfAlreadyExists="false" > 6 <Property Name="ContentType" Value="$Resources:cmscore,contenttype_masterpage_name;" /> 7 <Property Name="UIVersion" Value="4" /> 8 </File> 9 </Module> 10 </Elements>

    Images and Stylesheets

    Now we need to make sure that the images and stylesheets that are used by the custom MasterPage are deployed by the solution, these files will be deployed to the “layouts” folder on the file system. Better performance and easy to use in the MasterPage.

    Refer from the MasterPage to your StyleSheet by adding a css registration line.

    <SharePoint:CssRegistration ID="CssRegistration" name="/_layouts/1033/styles/DemoBlogPost/demo.css" After="corev4.css" runat="server"/>

    Then right click on the project in the solution explorer, “Add new item” and choose for “SharePoint "Images Mapped Folder”

    image

    If you want to create a mapped folder for your stylesheets you need to choose for “SharePoint Mapped Folder”, you then get a new popup file browser window that starts from the “SharePoint Root” hyve. Browse to your preferred styles location, usually: “Template\Layouts\LCID(1033)\Styles\” and click “ok”.

    image

    The only thing you need to do now is: add your images to the “Images” mapped folder (create a subfolder name for the specific customer or project, in this case:, “DemoBlogPost”) and do the same for the “Styles” mapped folder.

    Your solution is ready to be deployed, that would upload your custom files to the SharePoint environment and make the feature available for activation in Site Collection Features.

    Once you have activated that feature you will still need to manually set your custom MasterPage as the default for the SharePoint site with for instance: SharePoint Designer. This is something you don’t want to be doing for a lot of subsites(if there are any/many) so that’s why I created two event handlers.

    Setting a custom MasterPage as the default for a SharePoint 2010 foundation site.

    In order to make sure that all existing SharePoint 2010 foundation sites get your new custom MasterPage with custom branding you need to add a event receiver to the feature that was created earlier in this blogpost. This will take care of setting your MasterPage as the default on all sites after activating the feature.

    Right click on the feature and select “Add event receiver”:

    imageimage

     

     

     

     

    An event receiver was created.

     

     

    By default the newly created event receiver is opened for editing in visual studio. We need to add some code to make sure that all existing sites get this MasterPage as the default.

    Everything beneath this line:

    1 public class DemoBlogPostEventReceiver : SPFeatureReceiver

    You can replace with:

    1 { 2 public override void FeatureActivated( 3 SPFeatureReceiverProperties properties) 4 { 5 SPSite siteCollection = properties.Feature.Parent as SPSite; 6 if (siteCollection != null) 7 { 8 SPWeb topLevelSite = siteCollection.RootWeb; 9 10 // Calculate relative path to site from Web Application root. 11 string WebAppRelativePath = topLevelSite.ServerRelativeUrl; 12 if (!WebAppRelativePath.EndsWith("/")) 13 { 14 WebAppRelativePath += "/"; 15 } 16 17 // Enumerate through each site and apply branding. 18 foreach (SPWeb site in siteCollection.AllWebs) 19 { 20 site.MasterUrl = WebAppRelativePath + 21 "_catalogs/masterpage/DemoBlogPost.master"; 22 site.CustomMasterUrl = WebAppRelativePath + 23 "_catalogs/masterpage/DemoBlogPost.master"; 24 site.Update(); 25 } 26 } 27 } 28 29 public override void FeatureDeactivating( 30 SPFeatureReceiverProperties properties) 31 { 32 SPSite siteCollection = properties.Feature.Parent as SPSite; 33 if (siteCollection != null) 34 { 35 SPWeb topLevelSite = siteCollection.RootWeb; 36 37 // Calculate relative path of site from Web Application root. 38 string WebAppRelativePath = topLevelSite.ServerRelativeUrl; 39 if (!WebAppRelativePath.EndsWith("/")) 40 { 41 WebAppRelativePath += "/"; 42 } 43 44 // Enumerate through each site and remove custom branding. 45 foreach (SPWeb site in siteCollection.AllWebs) 46 { 47 site.MasterUrl = WebAppRelativePath + 48 "_catalogs/masterpage/v4.master"; 49 site.CustomMasterUrl = WebAppRelativePath + 50 "_catalogs/masterpage/v4.master"; 51 site.AlternateCssUrl = ""; 52 site.SiteLogoUrl = ""; 53 site.Update(); 54 } 55 } 56 } 57 } 58 }

    Save the event receiver and close it! You can now test your solution by right clicking the project in the solution explorer and choose “Deploy”. Now the feature will be deployed to the SharePoint SiteCollection we have selected as the debugging SharePoint site, also it will be automatically activated.

    Have a look at your SharePoint site and notice that your custom MasterPage is now applied to all existing SharePoint sites and subsites for the selected SiteCollection.

    image

    Make sure that newly created SharePoint 2010 Foundation sites get the custom MasterPage

    We have allready created an event receiver to make sure that existing SharePoint 2010 foundation sites have the custom MasterPage applied. In a non SharePoint 2010 Foundation site you would normally have the option for all subsites to inherit the MasterPage from the parent, the Site Collection default. In Foundation there is no such option, you need to do that manually with SharePoint designer or with an event receiver, this is our way to go offcourse!

    Right click on the project in the solution explorer and select, “Add new item”.

    image

    Then choose for “Event Receiver” and give it a name, I have used an example that I have seen elsewhere on the internet: ”ChildSiteInit”. It’s clear what you use it for, good job! Glimlach

    image

    Now you will be prompted with settings you can select for the event receiver.

  • Choose “Web Events” at the type selection and
  • A site was provisioned

    Click “finish” and the event receiver will be created for you! Open up the “ChildSiteInit” event receiver and replace:

    1 base.WebProvisioned(properties);

    With:

    1 SPWeb childSite = properties.Web; 2 SPWeb topSite = childSite.Site.RootWeb; 3 childSite.MasterUrl = topSite.MasterUrl; 4 childSite.CustomMasterUrl = topSite.CustomMasterUrl; 5 childSite.Update();

    This small piece of code makes sure that new sites created within the current SiteCollection will automatically be updated with the MasterPage settings from the parent site.

    That’s it, you have created a SharePoint 2010 Foundation MasterPage Solution that automatically is applied to all existing and newly created sites within your preferred SiteCollection.

  • Follow

    Get every new post delivered to your Inbox.