Posts Tagged ‘Tip’

Tip – Keyboard shortcut for Paste As Plain Text in SharePoint

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

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 :-

10 things developers should know about SharePoint

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

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.

How Much Does SharePoint Cost?

Date:November 24th, 2010 Author: Tags: , , , ,
Category: General, SharePoint Ideas Comments:17 ;

how much does SharePoint cost- small 2One of the top questions you’ll ask if you’re looking at deploying a SharePoint solution for your organization is – how much is this going to cost us? While the exact answer depends on the size of your business and what you want from SharePoint, this post will look at the cost of entering the SharePoint sphere.

There are many options available and many variables that may come into play here – so the figures we are giving are not designed to cost a solution down to the last cent – rather to give you a “ball park” idea of what each level of the SharePoint solution is likely to cost, and perhaps more importantly the size of the steps between each level.

(more…)

Sharepoint Governance #1 – aim for the sky

Date:October 18th, 2010 Author: Tags: ,
Category: General, SharePoint Ideas Comments:2 ;

So you’ve got your hands on SharePoint and you’re excited. Some might say we’re biased over here at the Pentalogic blog, but we definitely wouldn’t blame you for itching to deploy this user friendly and incredibly powerful server side software across your whole organization super quickly.

But wait a moment! Have you set out who will be in charge of migrating your shared drives to SharePoint, authorising new sites to be created and setting out an information lifecycle to manage your data? What about indexing information so it can be easily searched should you need an answer to be at your fingertips? If any or all of this sounds like a minefield to you, let me assure you that you’re definitely not alone.

Regulating SharePoint affects many users and most of us will look for guidance about managing our use of it at some point. With this in mind, we’ve put together a quick guide to explain why it’s vital to set out protocol for using SharePoint in your organisation sooner rather than later and have added some useful resources for you at the end.

(more…)

Why Tooltips are cool tips in PivotPoint Webpart for SharePoint

Date:September 9th, 2010 Author: Tags: , , ,
Category: PivotPoint Web Part, SharePoint webparts Comments:0 ;

Tooltips  – those little boxes that pop up when you hover over something – can be a blessing or a bit of a nightmare.  It drives me nuts when people enable those snapshot tooltips on every hyperlink on a page.  the resulting pop ups are huge, usually contain info I don’t want to see, and seem to hang around on the screen for ever.

But imagine a tooltip where you choose exactly what information is displayed?  How cool would that be?  Well that’s exactly what you get with tooltips in our PivotPoint web part  for SharePoint – which is why I think they rock.

(more…)

Using [Today] in SharePoint calculated default values

Date:September 2nd, 2010 Author: Tags: , , ,
Category: Calculated Columns Comments:15 ;

Despite the infamous “fake today column trick” still appearing in new blog posts on a monthly basis you can’t use Today in calculated columns in SharePoint.

I’ve seen people assume (not unreasonably) that the same rule must apply with calculated default values used in columns that are not calculated columns as well – but strangely,  you actually can use Today in calculated default values, so I am going to explain why it works and how you might use this.

What is the difference between Calculated Column and Calculated Default value?

A calculated column, erm… calculates values from other columns in your list.

SharePoint - add Calculated Column field

For example if you have an orders list with a Quantity and Price column you can calculate a Grand Total of Price * Quantity.

With a calculated default value you use a calculation to set the default value for a column that is not a calculated column – this is the value that is entered automatically when a new list item is created and may be over-written by the user.

SharePoint - setting a calculated default value

So why may I want a calculation using Today as the default value?

Suppose we have a list containing customer complaints and we have a target to resolve everything in 3 days. Sometimes though for complex queries or if there are public holidays we may give more time. In that case we can set the default value as

= Today + 3

But the user can override that if necessary (public holiday etc).

So why can I use Today here but not in calculated columns?

With a calculated column the calculation is only reworked every time a record is updated. When it’s just viewed then it picks up the saved result from the last edit. This makes perfect sense for most calculated values, but not for values using Today or Me.

So for example if we tried to calculate the days left until a due date we might want to use

Days left = Due Date - Today

If we added the complaint on Monday then it would show that we have 3 days left to do it (Thursday). If we just look at the record on the Wednesday it would still show 3 days (as this was the calculation saved on Monday) when in fact we only have 1 day left to keep the customer happy.

That’s why SharePoint wont let you use Today in calculated columns.

However with a default calculated value the result is only worked out once when the record is being created – it’s understood that what is saved in this field is not updated automatically so there is no problem with using Today.

For a bonus point – you can’t reference other fields in calculations for default values (e.g. Start Date or Order Date) as before a record is being created the fields don’t yet contain values.

What else could I do with this?

The OP in this thread is using it to set default financial years. Suppose that your company’s financial year starts in April then you could use this formula to default to 2009/10 or 2010/11 on or after April.

=IF(MONTH(Today)>=4,"2010/11","2009/11")

or generating the year 20xx/xx notation automatically :-

=IF(MONTH(Today)>=4,YEAR(Today) & "/" & (YEAR(Today)+1),(Year(Today)-1) & "/" & YEAR(Today))

It’s also worth noting that you can use a similar formula in calculated columns – suppose you have an Order Date field and the financial year depends upon when the order was placed then simply replace Today with Order Date.

NB – This has been tested with SharePoint 2007/2010.

Free SharePoint Calculated Column Cheat Sheet
a handy 3 page reference for calculated column functions and formulas.

SharePoint Staff Vacation Planner – DIY Guide part 5 – the system in action and Out of the box options.

Date:August 9th, 2010 Author: Tags: , ,
Category: PivotPoint Web Part, SharePoint Ideas, SharePoint Planner, SharePoint Reminder, SharePoint webparts Comments:0 ;

This is Part 5 of the SharePoint Staff Vacation Planner – DIY Guide

See the System In Action

So, now let’s reap the rewards for all of our hard work and see the system in action.

I need to book a day off for a hospital appointment on Friday 9th of July.  I can see all the absence bookings for my department and the number of days I have had off this year on the absence dashboards above. I’ve only had 1 day off for Medical Appointments so far this year and I am allowed 3 so that’s fine – but 3 people are off on that day already, it’s going to be tough, but I really need to go to that appointment.

So, as you can see, I can add a new item to the planner straight from the link in the webpart, I don’t need to go to the list.

Ryan receives the absence request email and from looking at his dashboards he can see that although I am well within my Medical Appointments entitlement approving this absence is going to leave him really short staffed on Friday – but he can’t face the thought of listening to me moaning about my in-growing toenail for another 3 months, so he approves the request.

Once the request is approved I get an email notifying me, and the status of the absence changes from “pending” to “approved” on the absence planner.

And for the final step in the process, is the email to Ryan on Thursday, to remind him that I am off the next day, giving him chance to make sure all my work is covered.

So now we should have no excuse for messing up staff absence planning ever again!

So Can’t I do this with SharePoint out of the Box?

Well some of it. Clearly, your basic list and filtered views are all set up in SharePoint out of the box.

When it comes to your dashboard views there are some limitations.

This is how your Vacation Planner Wall Chart looks out of the box:

or as a Gantt view:

We have lost all of our color coding, it’s not possible to show the name of the person who is absent, unless you make this the title of the event, and we have no way of distinguishing between approved and pending items.

For the “Absences to Date” and “My Absences” dashboards we can achieve something similar, if a bit clunky, out of the box.  From the settings tab in your Staff Absence Planner list, choose edit current view.

Head down to Group By and choose Requested By and Reason.  Then expand the Totals section and choose # Days Absence and sum.

 

 

This will give you a view like this:

The information is all there, but I have to work to get at it.  For example Ryan can see that I have had 11 days off this year, covering 3 separate occasions, but he is going to have to drill into each individual event and get his calculator out to figure out how many of my days off have been annual leave, training or Medical.

Then on to the workflow emails. It is possible to generate email alerts for the absence request and the request approval, but the solution isn’t perfect.  For absence requests an administrator can set the list up to email all line managers within your company or department, every time a new request is added to the list.  This means that managers will get absence requests from their own staff, but also from all other staff as well.  The only way to avoid this would be to set up a separate absence request list for each line manager.

For the request approved/rejected email the requester will need to set up an alert on each request as they create it, asking to be alerted any time anything changes on that list item.

When the alert emails arrive, this is how they look:

There is no way to edit the email, and give the recipient clues on what they are supposed to do with it.

The final “John Smith is off work tomorrow” email, cannot be generated in SharePoint out of the box, as it doesn’t do date based alerts.

You could do this with Workflow and Event Receivers, but that means having some technical knowledge and breaking out SharePoint Designer and/or Visual Studio.

So – can you build a staff absence planning system with SharePoint out of the box?  I guess the answer is “kind of”. It is possible to build a basic system but it’s going to lack some useful functionality and may now be enormously user friendly.

We hope you’ve found this useful.

If you would like to try the Vacation planning system you can download a 30 day free trial version here.

And as always, if you have any questions or comments, we would love to hear them.

How to edit List forms in SharePoint 2010

Date:July 29th, 2010 Author: Tags: , ,
Category: General, SharePoint Ideas Comments:6 ;

In SharePoint 2007 there is a well known trick for opening up a list’s forms (New/View/Edit) in design mode – append ?ToolpaneView=2 onto the url – this is often used to add instructions or javascript using a Content Editor Web Part (CEWP) e.g.

However when I first tried to use my tried and tested shortcut in SharePoint 2010 I came a little unstuck as now the New/View/Edit forms appear in a fake popup window and modifying the URL doesn’t work.

There are two ways to do this in SharePoint 2010 – and once you know where to find them they should actually make life that little bit easier.

The first is to open up the form in a new window and then add ToolpaneView=2 onto the end of the URL, so

Right click on Add new Item or the lists Title field and select Open in New Tab or hold down CTRL while left clicking.

Alternatively you can do this using the new-fangled ribbon toolbar – select under List Tools the List tab, then on the right hand side of the ribbon you should see an icon for Form Web Parts which gives a menu of the different forms associated with the list that you can edit.


Showing the records ID on the View and Edit forms

Date:July 23rd, 2010 Author: Tags: , ,
Category: SharePoint Ideas Comments:21 ;

SharePoint - Modify View and show ID column

ID’s are a convenient, often short, way to uniquely refer to something. Unless you’re the Tax man who seems to believe he can’t get through his day without giving me, thats just one person, 7 unique id’s – presumably one for each extremity that we would like a piece off…

I digress… ID’s – SharePoint uses an ID for each item in a list and sometimes its handy to know them “Ere Bob – have you done task 1234 yet?”

You can easily add them to the list view (Modify this View then find the ID column, click display)

SharePoint - view with ID column

But what about if you want to see this on the View and Edit forms? (You can’t see it on the New form as it doesn’t get an ID assigned until you’ve created it)

You can’t do this in the UI. You can create a custom View/Edit form using SharePoint designer but its quite complex, is a pain when we add new fields and its fraught with potential problems.

So instead we’re going to look into every ones favourite SharePoint UI hacking tools – the Content Editor Web Part (CEWP) and javascript/jQuery.

(more…)

SharePoint Calculated columns – Adding hours onto a date field

Date:May 18th, 2010 Author: Tags: , , ,
Category: General, SharePoint Ideas Comments:7 ;

A customer recently contacted me with an interesting question.

They were using a SharePoint task list to help schedule jobs for field engineers but rather than have a Start Date and End Date field they wanted to have a Start Date and Duration field and automatically work out the End Date.

So End Date = Start Date + Duration

They were then planning to display this using Planner in the By Category view which is idea for resource booking as it makes it easy to see when a resource is booked or free (SharePoints built in gantt chart can’t do this swimlane style of view and doesn’t support using calculated columns).

Now this is easy to do if the Duration is specified in days – in fact you just use the equation above – but what if Duration is in hours or minutes?

First port of call is this page from Microsoft showing examples of common date time formula you can use in SharePoint calculated columns hmmm, adding days OK… adding months Check… adding years OK too….but nothing about hours. Back to the drawing board.

(more…)