I needed to hide the ribbon on a specific Nintex form. Yes, the client had heard my arguments about why you should keep the ribbon and decided to remove the ribbon regardless. Removing the ribbon from that one form did not turn out to be quite as straight-forward as I expected.
Category Archives: sharepoint
Add a webpart to a view on any SharePoint list or library
One of my favorite features in SharePoint is the sheer power available in lists and libraries. I love teaching this part of the platform because there are so many hidden gems, functionalities that people really don’t know about but can make such a difference.
This post is about adding a webpart to a list or library view page. This functionality has been available since SharePoint 2010. Did you know that every single view in SharePoint is its own page and has its own URL, so that you can link directly to it? This means that every single view page can be edited so that you can add a webpart to it.
Three reasons not to hide the SharePoint ribbon
Occasionally clients ask me to remove the ribbon from their SharePoint environment. Technically speaking, it’s not hard to do – but there are many good reasons to keep the ribbon in place.
Sharing with external users: why doesn’t the user show up in the SharePoint group immediately?
When sharing with an external user, the user does not immediately appear in the permissions group. It turns out that the user needs to accept the invitation first.
Add permissions to SharePoint site via SharePoint groups
SharePoint permission configuration is one of the hardest things for end-users to understand. Sometimes it is easier to explain a specific scenario instead of how the entire permissions concept works.
What is governance in SharePoint 2013?
Microsoft has a ton of information regarding SharePoint governance. Considering that it’s such a broad subject, lots of documentation is good. The challenge is finding the most important bits.
The article that provides the best overview is Microsoft’s Technet article What is governance on SharePoint 2013? A related TechNet article is Governance planning on SharePoint 2013.It includes a download of one of my favorite Microsoft SharePoint governance resources: the huge overview image that shows how to tie it all together (see it on ZoomIt). Microsoft made one of these for SharePoint 2010 and possibly for SharePoint 2007. It has evolved as the product has matured but is a fantastic resource.
Calculated column: week number
I decided to organise a small project by using a SharePoint task list on a Office 365 project site. I figure that if it gets too complicated, I can always just open the entire thing in Microsoft Project.
I realized fairly quickly that seeing week numbers in the list was a valuable thing:
- Group the tasks by week
- See the total number of estimated hours per week
I created a calculated column and used the comments on this page, Group A List by Week Number. I ended up changing the formula a little bit – there are some activities in December and some in January, so I wanted to see the year, as well as the week number for sorting purposes.
My final formula:
=YEAR([Start Date])&"-"&If(Int(([Start Date]-Date(Year([Start Date]);1;1)+(TEXT(Weekday(Date(Year([Start Date]);1;1)-1);"d")))/7)=0;52;Int(([Start Date]-Date(Year([Start Date]);1;1)+(TEXT(Weekday(Date(Year([Start Date]);1;1)-1);"d")))/7))
The final result looks like this:
You can see an error on the third line: that’s because [Start Date] is empty on that line, so the week number could not be correctly calculated. I just wanted to get on with the project planning and not spend more time on the formula.
Once you have the week number in place, you can easily make views like this one, where I grouped by Week and then summed up the total hour estimate:
The formula has the following considerations:
- Weeks begin on Monday
- Working with Swedish regional settings – you may need to change around a few periods, semi-c0lons, etc.
Adding a code snippet to page content on SharePoint 2013
Note: this post is written specifically for SharePoint 2013.
Sometimes it is necessary to add a snippet of code to just one page. Examples could be:
- Alternative CSS for just that page, i.e. to style a specific element
- Add a piece of CSS to hide the left navigation on specific pages
- Add the Open In Explorer Link to a page
There are technically a number of ways to achieve this:
- Paste the code directly into the page contents (does not work)
- Paste the code into the the HTML source of the Content Editor Web Part (can work, depending on SP version and code)
- Use the Embed command (can work, situational)
- Save the code in a text file, save it somewhere on your SharePoint site collection and call the text file via the Content Editor Webpart (my preferred method)
Option #4 is my favorite for a number of good reasons:
- You can save the code centrally and then call it from multiple places without needing to replicate it
- By saving it centrally, you only need to update it once if there are changes or updates
- By saving it in the content database, you can access it from SharePoint Designer or similar, meaning you do not need to keep downloading-updating-uploading
- It works consistently across all versions of SharePoint from SharePoint 2007 up to Office 365
<p>All right reserved © <script> var cur = 2010; var year = new Date(); if(cur == year.getFullYear()) year = year.getFullYear(); else year = cur + ' - ' + year.getFullYear(); document.write(year); </script> </p>
Option 1: Paste the code directly into the page content
You can paste the code directly into the page content.
However, once you save the page and view it, you will see that SharePoint does not realize that it is code it needs to render in some way.
Conclusion: do not place code directly in the page content as it does not work.
Option 2: Edit source in rich text area / CEWP
In most content editor webparts and all rich text areas, there is a button in the ribbon called “Edit source”. This is great for quick fixes when content has gotten out of hand. In older versions of SharePoint, you could also use it to embed extra code.
You can easily paste your code straight into the Edit HTML window.
However, once you save, SharePoint lets you know that the code that it does not approve of has been stripped.
In this case, some of the embedded code has been stripped out.
Sometimes SharePoint will strip out all of it and sometimes it will only strip out parts which can cause an odd result. When it doubt, check back into the HTML source to see what has happened with your code and if it is still 100% intact.
Conclusion: while this used to work under some older SharePoint versions, it is generally not a reliable solution for SharePoint 2013.
Option #3: Using the Embed command
SharePoint 2013 includes an Embed command in the ribbon which can be great for adding code snippets to your page:
After clicking the command, you are prompted to insert your code and given a preview:
SharePoint creates a Script Editor webpart on the page for you. It even includes an “Edit Snippet” button, so you can go back and edit the code later.
Conclusion: in my experience, this works but is dependent on the complexity of the code. Test well before using.
Option 4: save as a text file, call via CEWP
Here is the file in Notepad++:
In this demo, I uploaded the HTML file to the document library on the same site as the page we are working with.
Tip: I tend to use the following rules of thumb as to where to upload these kinds of files:
- Think about if you want to save it in the standard Document library, or if you want to create a dedicated document library called “Scripts” or similar
- If the file will be called from just one single site, save it on the site
- if the file will be used across just one site collection, consider saving it at the root of the site collection or in the Style Library of that site collection (i.e. Styles/Scripts)
- If using across multiple site collections, choose the most logical place for it, i.e. on a root site collection
Next, place a Content Editor Web Part (CEWP) on the page and edit the webpart settings. At the top, add the link to the file and click “Apply” to save the changes.
The content should immediately display in the CEWP on the page.
Tip: if you wish to use the same webpart in many places, you could export the configured CEWP and import it as a custom webpart. You can then place it on a page and it will already be configured for you.
Conclusion: this is my favorite method due to the central storage of the files, ease of editing the files and reusability.
SharePoint social and Harmon.ie favorites in Outlook
One of my current clients works with the Harmon.ie Outlook addon for copying emails and documents to SharePoint. I believe it is a neat and useful tool which can complement OneDrive for Business.
I recently got a request to allow users to create favorite libraries/sites on SharePoint and have this list be synced with Harmon.ie.
Harmon.ie does not seem to have a way access SharePoint 2013’s “follow” functionality. This may be possible with registry edits or custom code, but I have not found the solution yet.
However, Harmon.ie can sync with the My Links list, which is part of the User Profile Service from SharePoint 2010 and onwards. Libraries can be added to this via the “Connect to Office” button. It is also possible in MOSS 2007.
SharePoint 2013 “follow”
In SharePoint 2013, new “follow” functionality has been added, allowing users to follow People, Documents, Sites, and #Tags. It is then possible to see updates via the newsfeed on your My Site.
The idea was to allow the client to select which sites they would like to follow, then use that information for two purposes:
- Display a list of favorite sites on the landing page
- Input for the “favorites” in the Harmon.ie Outlook client
The first goal turned out to be fairly easy – once I found out that the “Site” content type on the My Site is not actually searchable. There is a premade REST/jQuery soution available via I Am Following which worked beautifully. The page includes a link to the code download on Codeplex.
The second turned out to be quite a bit harder. I spent a lot of time investigating the Harmonie documentation and tried everything I could find, including using registry edits for site propogation in the Harmon.ie favorites. That site propagation turned out to only work for the enterprise client, not the free client and was really more for prepolating the client with specific sites. I was not able to get the registry edit “SyncFavoritesWithMyLinks” working, as described on Add My Links to the sites and favorites lists.
Conclusion: there is currently no good way to sync the followed content on SharePoint 2013 with Harmonie.
After lots of frustrating, I was rereading the documentation on the Harmonie site and came across the following:
When working with SharePoint 2013/2010, harmon.ie adds the document libraries defined via the SharePoint 2013/2010 ribbon button Connect to Office to your favorites list.
Source: Favorite Locations
My Links is the old bookmarking functionality in SharePoint, used in SharePoint 2007 and 2010. It was replaced by the follow functionality in SharePoint 2013. It requires the User Profile service to be enabled, as it is a per-user list. Clicking the button adds the current library to My Links.
You can access this, exactly as the documentation states, via the Library tab of document libraries:
This same functionality is used to create shortcuts in Microsoft Office applications for opening and saving documents.
To make this document library be added to the favorites in your Harmon.ie client, follow these steps:
- Click the “Connect to Office” button in the applicable library
- Restart Outlook (the list is checked on application startup)
- Find the new list in your favorites in Harmon.ie
You can maintain the My Links list by clicking on the dropdown on the Connect to Office button. You’ll see that the list looks pretty much as it did in SharePoint 2007.
Harmon.ie: Favorite locations (in Outlook)
Office Blogs: Following in SharePoint 2013
Thanks go to Wictor Wilén for his tips
Calculated column for priority on a SharePoint list
I’m currently working on a project where we needed to assign a priority to issues based on impact and urgency. You could always let users figure this out for themselves, but it’s much better to automate it when there are clear definitions for each value and a table which translates the impact and urgency to priority.