Complete guide to filtering SharePoint lists by the current week.

Date:September 17th, 2012 Author: Tags: , ,
Category: Calculated Columns, Filter, SharePoint Ideas Comments:7 ;

A common requirement in SharePoint is to filter lists so you’re only showing the current week, month, quarter etc. If you only want to see the last X number of days (e.g. last 30 days) then it’s simple enough.

If you want setup a SharePoint view to see the current calendar week then its a little more complex – especially if you define your week differently from the standard Sunday to Saturday or Monday to Sunday.

First you must look at and really understand the method for setting up SharePoint views to filter the current calendar month or week as it’s not really obvious.

Long story short – here are the steps :-

  • Use one of the calculated column formula below to find the “Start of week
  • Use a calculated column formula of “End of Week
        = [Start of Week] + 6
  • Setup a View Filter showing items when [Today] is in that range.
        Start of Week <= [Today] AND End Of Week >= [Today]

Again – see this post for showing the method in step-by-step detail.

If your week goes Sunday to Saturday or Monday to Sunday then use :-

Start of week End of week
Sunday to Saturday
 =[Due Date] - WEEKDAY([Due Date]) +1
 =[Start of Week] + 6
Monday to Sunday
 =[Due Date] – WEEKDAY([mydate],2) + 1
 =[Start of Week] + 6

Obviously you will replace [Due Date] with your own particular date field.(Check out the WEEKDAY function to understand what the 2nd argument does)

The other options are a bit more complex to find the start of the week (again end of week = start + 6)

Start of week
Tuesday to Monday
 =[Due Date]-WEEKDAY([Due Date])+IF(WEEKDAY([Due Date])<3,-4,3)
Wednesday to Tuesday
 =[Due Date]-WEEKDAY([Due Date])+IF(WEEKDAY([Due Date])<4,-3,4)
Thursday to Wednesday
 =[Due Date]-WEEKDAY([Due Date])+IF(WEEKDAY([Due Date])<5,-2,5)
Friday to Thursday
 =[Due Date]-WEEKDAY([Due Date])+IF(WEEKDAY([Due Date])<6,-1,6)
Saturday to Friday
 =[Due Date]-WEEKDAY([Due Date])+IF(WEEKDAY([Due Date])<7,0,7)

See this picture for some test data, its in a strange order (Thursday to Wednesday if first) but check it out on your desk calendar if you’re not convinced!

SharePoint Online – options for email enabled document libraries and lists.

Date:August 18th, 2012 Author: Tags: , , ,
Category: General, SharePoint Online / 365 / Cloud Comments:2 ;

“Email enabled document libraries” are a popular feature in SharePoint – you can send email to a specific address and the email gets put into a document library or list.

This feature isn’t supported in the hosted version of SharePoint (SharePoint Online / Office 365 or BPOS) but there are 3rd party apps that enable this.

A SaaS app that allows rules for what happens to the emails based on email address, content, attachments and promote email content to list meta data. Currently in limited beta, pricing not decided.

Runs as an application on a local workstation and moves emails from an Exchange Online mailbox to SharePoint Online list according to user defined rules. Free to use – support provided if you set MessageOps as ‘partner of record’.

SaaS app to to provide email enabled document libraries with options to store attachments away from SharePoint storage. Pricing not disclosed.

Desktop program that runs in the background on a user’s computer and move emails from Outlook 2007/2010 folders into SharePoint online or on-premises. From $165 per profile (folder/incoming email address).

In the Cloud: New web parts for SharePoint Online!

Date:July 23rd, 2012 Author: Tags: , ,
Category: General, SharePoint Alert, SharePoint Online / 365 / Cloud Comments:0 ;

We know that some customers are considering moving to SharePoint Online and have been asked if our SharePoint web parts are compatible.

To run on SharePoint Online a web part has run in the Sandbox Model. Quite frankly this is hard and there are many restrictions – which is why there are so few vendors selling cloud compatible web parts. For our own products some features would have to be removed (e.g. web part connections in Planner and PivotPoint) some would have to be radically re-designed (such as TeamTime) and with some (FilterPoint and Highlighter) it’s just not possible to run them in the sandbox model at all.

The strategy we’re adopting is to create SharePoint Online / Cloud specific versions of our web parts to avoid having to ‘dumb down’ our normal on-premises web parts.

Date based email alerts for SharePoint Online

First up is a cloud specific version of Reminder that allows you to add customizable and date based email alerts to SharePoint Online / Office 365.

Date based email alerts for SharePoint online

Email enabled document libraries in SharePoint Online

We’re also developing a service that will allow you to use Email enabled document libraries in SharePoint Online – something that’s provided out of the box in normal on-premises SharePoint installations and many people are surprised to learn is just not available in SharePoint Online.

Email enabled document libraries for SharePoint online / 365

Not in the cloud?

Don’t worry, our feet are still firmly on the ground! We’re not going to forget about those of you who don’t plan to move to SharePoint Online and those of you who appreciate the extra flexibility of traditional on-premises installations that give more power to be able to adapt and enhance the platform your your needs.

As always – get in touch if you have any questions or feedback or would like to let us know which product you would like us to adapt.

SharePoint Sandbox Solutions: The Good, The Bad, and The Ugly

Date:July 11th, 2012 Author: Tags: , , , ,
Category: General, SharePoint Development, SharePoint webparts, Training Comments:3 ;

Sandbox solutions are often seen as the cure-all for the worries of installing in-house or third party software on your SharePoint farm; but all is not as it seems.

This article aims to dispel some of the illusions around the safety of Sandbox Solutions, and cut through some of the fluff about what the sandbox should actually be used for and why.

  • The Good: What sandbox solutions do well
  • The Bad: What sandbox solutions don’t protect you from
  • The Ugly: The compromises you have to make to use them

What is a Sandbox Solution?

A Sandbox Solution is just like a normal Farm solution, except that it is deployed to a specific Site Collection (rather than the whole Farm), and has a limited set of tools it can use.

A full listing of what you can and can’t do in the sandbox can be found here:

Sandbox Solution Considerations (section “Capabilities and Elements in Sandboxed Solutions”)
Restrictions on Sandboxed Solutions in SharePoint 2010

It’s just like having a toddler in a sandbox in your garden (or yard): They can build sandcastles and dig holes using the tools you give them, but they can’t play with the chainsaw or ride-on mower you’ve left lying around (or dig enormous holes in your flower beds).

The Good

Sandbox Solutions are prevented from doing many things that could cause security or performance issues on your SharePoint server. Notable restrictions include:

  • No access to the network(s) your server is connected to
  • No access to the server’s registry
  • No access to the server’s filesystem
  • No access to e-mail via SMTP
  • Permissions cannot be elevated

There are also some additional features to help keep solutions in line:

  • Solutions can be installed at the Site Collection level by Site Collection administrators.
  • Resource Usage Limits are applied to solutions and can be monitored and limited by the administrator, preventing faulty or processor-hungry code from overwhelming the server.
  • Solutions can be automatically validated, and known troublemakers can be banned from the entire farm.

Notably, the main benefit to the Site Collection administrator is the ability to deploy their own solutions, but the majority of the other benefits are to the Farm administrator (and/or hosting company); although everyone benefits from the improved system stability these features help to ensure.

The Bad

There are a great many features to help with system stability and the prevention of security breaches; but there are limits to what the solutions are prevented from doing.

You should certainly never deploy untested third-party solutions to the sandbox “without fear of bringing down the entire farm”.

The best example of a danger to stability from within the sandbox is the lack of control over the Client Object Model, mentioned here: Sandboxed Solutions in SharePoint 2010

Pages, Web Parts, and controls that are deployed in sandboxed solutions can include code that runs against one of the SharePoint Foundation client-side object models … Code that runs on the client computer is not subject to any of the code execution or resource usage restrictions.

For example, a solution could contain malicious or badly written code executed via COM that requested all the items in a list an infinite number of times. If embedded into a web part, this would effectively turn the computer of every user that viewed it into a node of a DDoS attack on the server farm.

Rather less dramatically, it’s worth noting that there are no specific restrictions on actively malicious code within a Site Collection. It’s perfectly possible to:

  • Delete sites and sub-sites
  • Add COM calls to export data to an external site (much like Wictor’s data import)
  • Copy data added/edited in lists with item-levels permissions to unrestricted lists

The Ugly

Although sandboxing adds restrictions at every level of SharePoint, the feature wasn’t in the original platform design (in SharePoint 2007). In order to squeeze this feature in, some sacrifices had to be made.

Since there’s no access to the filesystem, the following aren’t possible:

  • Application Pages
  • Visual Web Parts (since they deploy a Control Template)

There are a some compromises due to Split Page Rendering; where sandboxed web parts are rendered separately from the rest of the page in a controlled thread:

  • No Script Manager to output/organise JavaScript
  • No web part connections
  • No access to the page Cache

Similar to the above: Because sandbox solution code needs to run in a controlled thread, the following functionality (that uses separate threads) had to be removed:

  • Workflows containing code
  • Timer jobs

Although most of these compromises are understandable, there are some features that are missing for no apparent reason:

  • You cannot use any of SharePoint’s own web controls (e.g. Date picker, User selection)
  • You cannot hide Custom Actions, or add Custom Action Groups

Conclusion

Sandboxing makes it less likely that you’ll accidentally destabilize a SharePoint farm with broken code, and make it easier to find and deal with trouble making solutions.

It’s also more difficult for malicious code to gain access to anything outside the Site Collection it’s deployed to, and slightly more difficult to destabilize the farm.

However, it doesn’t guarantee safety from either bad or malicious code and there are a large number of compromises to consider. Working around sandbox limitations will add overheads to most development projects, and many solutions will simply not fit into the sandbox model.

For example: FilterPoint and Highlighter are two of our own products that can never be made sandboxable, as they’re based on features that are simply not available in the sandbox.

Edit: Since the publishing of this post, we’ve discovered that sandbox solutions are now deprecated in SharePoint 15; as mentioned in the article SharePoint 2013 preview – Apps or Crapps?.

Opening an URL in a new Window from a SharePoint list

Date:June 22nd, 2012 Author: Tags: , , , ,
Category: SharePoint HTML Calculated Column Comments:2 ;

HTMLCC-logo

A missing feature from SharePoint’s URL column is the ability to open links in a new window. However, our free HTML Calculated Column lets you do this in just a few easy steps.

Step 1: Get the software

Download our software from here: HTML Calculated Column Download

It’s free, but you’ll have to sign up to our newsletter. Don’t like our newsletter? Just unsubscribe. No logins, no e-mail reselling, no spam, no drama.

Just run the installer on your server and you’re done.

Step 2: Create a Text column

Add a simple Text column to your list (not a Hyperlink column). Create it as normal, call it ‘URL’ or something similar, and put an URL in it.

Calculated columns (both SharePoint’s and ours) don’t support Hyperlink columns, so it isn’t possible to use these in the formula below.

Step 3: Create an HTMLCC column

Next is our Pentalogic HTML Calculated Column (catchy name, eh?). Create it as you would a normal calculated column, and put the following formula in it:

=”<a href='”&[URL]&”‘ target=’_blank’>Link</a>”

The part that does the actual new window opening is the “target=’_blank’”, and [URL] is the name of your text column. You can customize the formula however you like; possibly with the help of our Calculated Column Cheatsheet.

When you save, you’ll see our cautionary malicious code warning. If you have users you don’t trust able to add/edit items in this list, then… well… sack them (or have them sacked). Then tick the box and click OK.

And while we’re here…

The “[?]” link to our site in the column title has been removed: We heard how annoying it could be, so we got rid of it.

Just upgrade to the latest version (1.3) to update your existing columns.

Let us know what you think of our free SharePoint tools and our other SharePoint web parts: [email protected]

Tip – Keyboard shortcut for Paste As Plain Text in SharePoint

Date:June 14th, 2012 Author: Tags: , ,
Category: General Comments:5 ;

If you spend any amount of time copy and pasting stuff into SharePoint’s wiki or rich text fields (or indeed working with web based rich text editors of any kind) then you’ve undoubtedly have been burned by the crAzY FormaAting monster! This is because the formatting that works so beautifully in one place may not work well in another site.

Of course in SharePoint 2010 you’ve got the Paste as plaintext option in the toolbar, but I am a keyboard warrior damn it! I don’t have time for faffing about with a mouse!

If you’re as impatient as I am (or aren’t using SharePoint 2010) you’ve probably got around this with the Notepad dance to remove formatting – Select source, CTRL+C, Open Notepad, CTRL+V, CTRL+A (select All), CTRL+C, switch to destination and finally CTRL+V to paste plain text… but there is an easier way – CTRL + SHIFT + V to Paste As Plain Text!

If you’re using :-

Send email alerts when a document is left checked out

Date:May 28th, 2012 Author: Tags: , , , ,
Category: SharePoint Reminder Comments:2 ;

A new version of our Reminder web part for SharePoint has been released (v1.7.16) that allows you to send email alerts if a document is left checked out for a long time.

If you have document libraries that require check out before editing then you’ve undoubtedly been faced with the situation where documents have been left checked out – blocking other users from editing the document.

Reminder allows you to send email alerts after a period of time to ensure checked out documents are not forgotten about.

This example shows how to setup Reminder to send email alerts if something in a document library is left checked out for more than 12 hours.

SharePoint - email alerts when a document is left checked out

The manual contains other common scenarios such as email alerts when Task/Due and Overdue, simple helpdesk in SharePoint, enhanced SharePoint alerts and more.

You can download and upgrade to the latest version.

TeamTime just went up a gear

Date:May 16th, 2012 Author: Tags: , , , , ,
Category: SharePoint TeamTime, SharePoint Timesheets Comments:0 ;

We’ve added some new bells and whistles to the latest version of TeamTime:

  • Add your own columns to the timesheet (Custom Columns)
  • Pull data from multiple TeamTime sites in to a single place (Overview Site)

Custom Columns

You can now add and reorder columns on the timesheet on your TeamTime homepage. For example, you can add Cost Center codes to record where the time is chargeable to:

tt_cc_example

This data can then be used to produce Reports and Analysis within TeamTime. It can be accessed via our extensibility lists to integrate with other systems in your organisation.

Here are some other useful columns you could add:

  • Overtime flag
  • Chargeable client
  • AM/PM

For more information see our Custom Column Guide.

Overview Site

Since there is no limit to the number of TeamTime sites you can have, we encourage creating smaller sites with fewer users. We’d recommend about 10-20, and certainly less than 50.

Having several small sites keeps it easier to use, as Marketing isn’t tripping over Development’s tasks, and the approvers don’t waste time trying to figure out who the heck “David Jones” is.

The next question is of course “How do I consolidate the data from all those sites into one place?”, and the answer is to use an Overview site.

Overview

Simply create an Overview site exactly as you would a normal TeamTime site, and pull the data from all your sites in the site collection into one place.

The Reports and Analysis are in the same familiar location and layout, with direct access to the consolidated list data as a bonus.

For more information see our Overview Site Guide.

Try it out!

Give our 30 day free trial a go:

If you’ve trialled TeamTime in the past, just ask us for a trial extension: [email protected]

If you’re upgrading from an earlier version, please see the following: v1.4 Upgrade Notes

New version of PivotPoint web part for SharePoint – v2.2.3

Date:May 15th, 2012 Author: Tags: , , ,
Category: General, PivotPoint Web Part Comments:0 ;

A new version of our PivotPoint web part for SharePoint (v2.2.3) is ready.

This new version improves performance for large lists, corrects bugs when you have angled brackets (“<” and “>”) in your row or columns, adds support for site column lookups and a 2 new features.

Sort by Title or Total

The new version of PivotPoint allows you to sort by both the Title and Total rows, either ascending or descending.

Title and Total cells

For example, instead of sorting alphabetically by product you can sort by their total sales – showing your best performing products at the top of the table or left of the chart.

PivotPoint showing all columns

More details are in the online manual.

Show Top N

In combination with sorting by the Total you can choose to show the Top N columns or rows.

For example given the following data the vast majority of revenue comes from 2 products (Bottle-o-matic and Can-o-Matic) and we have a ‘Long Tail’ of other products.

We can choose to only display the top 2 columns (products) and optionally group all the other sales into “Other”

PivotPoint for SharePoint showing top 2 columns

 More details are in the online manual.

You can download and upgrade to the latest version without losing any settings.

10 things developers should know about SharePoint

Date:May 4th, 2012 Author: Tags: , , , ,
Category: Community, General, SharePoint Development, Training Comments:1 ;

Many developers walk into the world of SharePoint unaware of the strange and interesting journey of discovery they’re about to begin.

It’s often difficult to know where to being, so here’s the top 10 most useful things I’ve learned since I joined Pentalogic back in 2010.

Pitfalls

1. Know your Editions
2. Don’t even look at the database
3. Get to know the front-end
4. Dispose of your disposables

Building your Knowledge

5. Learn the language
6. Get a good book
7. Love the MSDN documentation
8. Find a SharePoint community that suits you

General advice

9. Learn to live with CAML
10. Remember that SharePoint is enormous
Conclusion

1. Know your Editions

SharePoint comes in many flavours, each of which has it’s own features and shortcomings. Here’s a quick run down of the notable versions:

Release Cheap Expensive MS Hosted
2007 WSS3 MOSS BPOS
2010 Foundation Standard/Enterprise SharePoint Online
/ Office 365

It’s useful to get to know these for when you’re searching for solutions, as you’ll sometimes come across those that are edition specific (e.g. the Standard Edition’s ContentIterator class for querying large lists).

There are few things more frustrating than finding the perfect solution, and then discovering you have the wrong Edition.

2. Don’t even look at the database

To those new to SharePoint this is entirely baffling: Why wouldn’t you want to get data from the database? There are two good reasons for this:

a) Microsoft is very touchy about their database. They will not support any installation with software on it that modifies the SharePoint database.

b) The structure will give you nightmares. At some point in almost every database developer’s career they say: “Why don’t we abstract the table structure, and just have one massive generic table of text data?”

They’re then hit in the head by whatever small throwable object happened to be nearby, and their colleagues point out that although it would be very flexible, it would also be fantastically slow and unwieldy.

Unfortunately either the SharePoint team operated a clean desk policy, or they put an extraordinary value on flexibility, and the result is lurking in the darkness of the SharePoint database.

3. Get to know the front-end

It’s very tempting to dive straight into the code side of things, but when you’re trying to orientate yourself in the API it helps to have a good understanding of what you’re looking at from the front-end.

It’ll also give you a good feel for the site’s design, and hence what sort of layout the users will expect to see.

Many of the actions you perform in code will correlate to actions in the front-end, as well as the structure.

For example, to find a particular list’s view in the front-end, you would:

  • Open the site using the URL
  • Open the sub site
  • Select the list
  • Select the view

The code version of which is very similar in structure and information needed:

    using (SPSite site = new SPSite(http://site))
     {
         using (SPWeb web = site.OpenWeb("subsite"))
         {
             SPList list = web.Lists["List name"];
             SPView view = list.Views["View name"];
         }
     }

4. Dispose of your disposables

Some SharePoint objects (in particular SPWeb and SPSite) won’t automatically dispose of themselves when they’re no longer used. If you’re unaware of this, then you may easily run into post-deployment problems caused by the ensuing memory leaks.

The code in the previous section shows one method of dealing with this problem, and here is Microsoft’s advice on the subject: Disposing Objects

Interestingly, you shouldn’t always dispose of these objects; for example you shouldn’t dispose of  SPContext.Current.Web. As a general rule of thumb:

If you made it, dispose of it. If you were given it, leave it.

5. Learn the language

There is a huge amount of SharePoint-specific terminology, and some of it can be inconsistent and often misleading. For example, a Site Collection is an SPSite object, but a Site is an SPWeb object.

Another example that caught me off guard at first was that there’s a difference between the Object Model (the server-side SharePoint API) and the Client Object Model (client-side API). Whereas I was under the impression that one was an abbreviated form of the other.

Microsoft has published an enormous glossary, which seems to cover quite a lot of it: Glossary for SharePoint 2010. Although as with any jargon or language, most of it is learned along the way.

6. Get a good book

A good reference guide is infinitely more useful than an enormous glossary when getting to know the components of SharePoint. It’s vitally important that you get an overview of all of these components, to avoid inadvertently reinventing the wheel.

There are two I can personally recommend (having read them both cover-to-cover):

Building the SharePoint User Experience (Furuknap): Written for 2007, but still covers the mainstay of SharePoint. An easy and interesting read: If you’re quickly bored by dry textbooks, then this is definitely the book for you.

Inside Microsoft SharePoint 2010 (Various): A good follow-on from Furuknap’s book. A solid foundation of 2010 knowledge, and a good one to refer to now and again. Don’t start with this book though, or you’ll find yourself climbing a pretty steep cliff.

As your SharePoint knowledge grows, revisiting the books can also be quite useful. Parts you may have glossed over previously will suddenly start to make more sense, and you may find some useful tips you missed first time.

7. Love the MSDN documentation

Having developed and worked with a great many third party APIs and interfaces in the past, I can say with considerable confidence that the MSDN documentation is phenomenal.

Every class, method, and property is documented. Even the most obscure properties have at least a placeholder page, which in itself offers more information than many specifications. On top of this is the community comments on each page add clarification and often links to useful related articles.

However, there are two minor shortcomings. The first is that the background documentation (such as “Disposing Objects” mentioned above) is usually painfully boring to read and often skims around subjects rather than getting to the point.

The second is that the CAML documentation is very bizarrely structured: Elements used for almost completed different things share the same page just because they have the same name. There is also missing documentation where the CAML is more obscure, such as the elements used in SPWeb.ProcessBatchData().

8. Find a SharePoint community that suits you

Sometimes no amount of Googling or searching of MSDN’s documentation will find you the answer to the problem that’s been bugging you. In these circumstances it’s good to have a community of like-minded SharePoint developers to help you with your problem.

Being an active member of a community will also help you to expand your knowledge of SharePoint in general.

Here are a couple of the more notable SharePoint developer-friendly communities:

I’ve previously discussed the differences between the two in the following article: SharePoint Questions: MSDN versus Stack Exchange

9. Learn to live with CAML

Collaborative Application Markup Language (CAML) is another example where flexibility seemed to take precedence over usability. In certain circumstances you’ll be forced to write unserializable and poorly validated XML to perform seemingly simple tasks, such as importing comparatively small quantities of data (a few thousand rows).

However, it isn’t all bad: As I mentioned, CAML does allow a great deal of flexibility, and also has very easily readable syntax. The core resource for CAML can be found here: Collaborative Application Markup Language Core Schemas

When querying data you can avoid CAML by using LINQ, which is reputedly faster and easier to use. If you have no fear of CAML (or are working on 2007), the following tool may be of use to you: U2U CAML Query Builder

P.S. While we’re talking about tools, I should mention the extensive and impressive list of SharePoint development tools found here: List of SharePoint 2007 development tools

10. Remember that SharePoint is enormous

It’s important to bear in mind that SharePoint is a mind bogglingly large framework, with dark corners that even the SharePoint Development Team themselves haven’t visited in years.

This is important because occasionally you’ll find an area that’s poorly documented or has strange known issues, and it helps to have a little perspective on the scale of the system you’re dealing with.

You also need to be aware that there’s an awful lot you don’t know, and some of which you may never know. Getting a good overview of the components is essential. I wouldn’t recommend designing a project to use a component (such as a Custom Field Type or Site Template) until you’ve at least made a prototype in that area; to appreciate the depth of what you’re tackling.

The variety of customizable components in SharePoint also means that there is almost always more than one solution to a problem, as you can see in some of my previous posts: How to do list highlighting in SharePoint

Conclusion

The first challenge in SharePoint is discovering the existence of all the things you don’t understand yet. Once you’ve got a vague idea of all the different components, then you can really start to learn what each is about.

To borrow Mr Rumsfeld’s turn of phrase: Once all your unknown unknowns are known unknowns, you can start learning known knowns.