Creating Dynamic List Menu For SharePoint Foundation 2013 Navigation

Hello Everyone, today’s article is going to have an intensive information about how to style the navigation menu for SharePoint Foundation 2013, in this case, we’ll have some common requirements, and we’ll go through how to achieve them to deliver a nice looking menu for the top navigation.

Problem:

The requirement that we have this time, is to create a menu which will include sub-items (dynamic items) that will appear when we hover over the static menu item.

We need all static menu items to have the following characteristics:

1- To be in uppercase format, meaning all letters in the sentence should be capitalized.

2- To have the white color, and a custom color: #f0b530 in case of anchor hover (Note that some of the static items maybe used only as containers for dynamic list items, and don’t act as hyperlinks).

The characteristics for the dynamic list that appears when we hover over a static item that contains sub-items:

1- To have the width of the maximum li that will appear inside the list, if you have a list item that will be 400px long, the ul should stretch to fit that size.

The characteristics for the dynamic items inside the list:

1- To have the “>” before each item

2- To have only the first letter in the sentence as capital letter, only the first letter in the sentence.. remember that!

3- On hover, to have a custom color, same one mentioned earlier: #f0b530

These are the requirements, so let’s get to the solution, shall we?!

 

Solution:

 

First things first, for my example, I use the following css to set the background color for my menu:

.ms-core-listMenu-horizontalBox {

background-color: rgb(163,160,143);

text-transform: uppercase;

}

Now we will need to style the static menu items that act as a container for my ul, to give them a white bold text, use the following css:

li.static span.dynamic-childrenspan {

color: white;

font-weight: bold;

}

As you see in the image below, the background color gave us a nearly grey background, and all letters in the static items are uppercase as required, note also that they are bold and white colored which what the second css snippet does.

nav1

Now, what if we hover over the “RESSOURCES HUMAINES” item, ul should be displayed with all items inside, and we should have the ul width to equal the longest item inside, also all items should have the first letter capitalized, and prefixed with > character, so use the following css for that:

li.dynamic {

height: 25px;

width: 100%;

white-space: nowrap;

}

The style above, gives a height for each item inside the list for 25px, and a maximum width it can get, which is 100%, also the white-space: nowrap, it prevents the item from breaking to a second line when it gets to a specific width, this is a MUST USE.

Now we’ll add > before each link as follows:

a.dynamic:before{

width: 100%;

content: ” > “;

}

In this case we are using a pseudo class for the anchor to prefix it using the content property.

We need the anchor tag to have the white color by default, not the blue color:

a.dynamic{

font-weight: bold;

color: white!important;

}

And when hovering, to have the custom color:

li.dynamic:hover a {

color: #f0b530!important;

}

But what about having it all in small letters, and the first letter in the sentence to be capital letter? You might think you would get a way with Text-Transform: Capitalize, but wait a minute, this property will capitalize the first letter of EACH WORD, remember we want only the first letter of the first word, we’ll use the following snippet:

li.dynamic span {

display: inline-block;

text-transform: lowercase;

}

li.dynamic span:first-letter {

text-transform: capitalize;

}

The first style, will change the display for the span to inline-block, this is because in the second style we want to use the :first-letter, and this pseudo selector works on block elements only (span by default is not block), and we also transform all text to lowercase, in the second style, we get the first letter of the span, and capitalize it, nice ha?

To the last part, to style the ul itself to make it stretch, convert the display to inline-table, and give it a large z-index so it’s always shown when hovering:

ul.dynamic{

display: inline-table;

z-index: 10000;

}

That’s it, now you should have something that will be similar to this:

na2

Enjoy your SharePoint designing now!

M . D

Basic operations in SharePoint with Excel

 

End users are the core foundation of SharePoint usage, SharePoint was made to serve end users, developers do custom solutions to serve end users, and admins make sure the environment is working fine so end users can do their work easily. One of the features that SharePoint provides out of the box, is the ability for end users to use the tools they already know, and integrate it with SharePoint, and one of these tools is Excel. 

 

This blog post is targeted towards end users who are new to SharePoint and wondering how they can use Excel within SharePoint, so let's see some super easy steps on what you can do with SharePoint. 

 

Let's say you are working on an Excel document locally on your computer, for me for example, let's say am working on a document listing partners for my company, my Excel workbook looks like this: 

 

1 Title 
2 Fictional Company 1 
3 Fictional Company 2 
Address 
MTL 
MTL 
Number of Projects

 

 

Now I would like to have this in SharePoint as a list, so I can share it with others. When you want to import an Excel sheet do SharePoint, SharePoint will not import the whole document, it will ask you for a specific range that you may want to upload to it. For example, If you have an Excel workbook with columns A through J, you might want to upload the columns A to F only, so you don't have to create a new Excel sheet just for these columns. There are multiple ways to do so, but the easiest way is, to highlight the area that you want to upload to SharePoint 

 

Fictional Company 1 
Fictional Company 2 
Address 
MTL 
MTL 
Number of Projects 
2

 

 

And then click Formulas from the ribbon, and choose Define Name: 

 

Formulas 
Text Date & 
Time • 
Library 
-itle 
Data 
Lookup & 
Reference • 
Review 
Math & 
View 
More 
Power Pivot Tell me what you want to do 
—x @ Define Na me 
Use in Formu 
Na me 
Trace P re 
Trace Del 
Trig • Functions • 
Manager Create from Selection Remove 
Defined Names

 

 

Add a descriptive name: 

 

C:\Users\owner\AppData\Local\Temp\msohtmlclip1\02\clip_image004.png

 

 

And Save your document, and make sure to close it. 

 

What did we just do? We have our Excel sheet as it is, we just gave a name to the selected area that you want to upload to SharePoint, that's it, nothing major.

 

Now to upload your document to SharePoint, you have to forget about all other browsers, and use Internet Explorer, because the upload to SharePoint functionality requires a browser that supports ActiveX control, so you will have an error like this if you try to use Edge or Chrome: 

 

technifier.sharepoint.com says: 
This feature requires a browser that supports ActiveX controls.

 

 

So open Internet Explorer, and select the gear icon, then choose Add an app: 

 

Change theme 
Office 365 settings 
Add an app 
Site conte 
Change the look 
Site settings

In the search box, you can type: Excel, then you'll see "Import Spreadsheet" app, click it and give it a name, in my case I'll just name it: Our Partners, give it a description if you want, and click browse, then choose your document, and hit import. If you get an error that looks like this: 

 

Message from webpage 
The specfied file is not a valid spreadsheet or contains no data to 
import.

Then you need to add the current SharePoint site to the list of trusted sites in Internet Explorer, to do so, click on the gear icon in Internet Explorer on the far top right corner: 

 

Machine generated alternative text:
Print 
Zoom (100%) 
Saf ety 
Add site to Apps 
View downloads 
Manage add-ons 
F12 Developer Tools 
Go to pinned sites 
Compatibility View settings 
About Internet Explorer 
Ctrl+J

 

 

And choose Internet Options, Open Security tab, and click Trusted Sites, then click Sites button: 

 

 

Machine generated alternative text:
Genere!o Security Privacy Content Connections Programs 
Select a zone to Vien or change security settings. 
Internet Local Intranet Restricted 
sites 
T rusted sites 
This zone contains vvebsites that pu 
trust not to damage your computer or 
Advanced

 

 

 

Make sure to add the current SharePoint site URL, and click Add, then Close. Then try to import the document again. If it gave you the same error, then try restarting Internet Explorer, and repeat the steps before to Import from Excel sheet. 

 

Now, once you click on Import, your Excel document will open and you'll see a popup that looks like this: 

 

Import to Windows SharePoint Services list 
Range Iype : 
Table Range 
Range of Cells 
Table Ran e 
Named Ranae

 

 

Choose Named Range, and choose the Name you specified earlier, and hit Import. Wait for the SharePoint magic to take place, and you'll see your Excel sheet uploaded to SharePoint:

 

Our Partners 
@ new item or edit this list 
All Items 
Title 
Find an item 
p 
Address Number of Projects 
Fictional Company 1 
Fictional Company 2

 

 

If you check the columns for this list, you'll see that SharePoint is smart enough to infer the types of columns, and it will create a Number column for our "Number of Projects" column: 

 

Columns 
A column stores information about each item in the list The following columns are currently available in this list 
Column (click to edit) 
Title 
Address 
Number of Projects 
Modified 
Created 
Created By 
Modified By 
Type 
Single line of text 
Single line of text 
Number 
Date and Time 
Date and Time 
Person or Group 
Person or Group

 

 

 

 

You successfully uploaded a Range in your Excel workbook to SharePoint and created a list out of it! That's all good, and it's all basic stuff. Now let's try it backwards! Let's say you have a SharePoint list, that's called Our Partners, and you want to be able to view it in Excel locally, without opening the site. What can you do in this case? Remember that the Import process is just one time push from Excel to SharePoint, and it won't make any kind of connection between the document on your computer and the list. 

 

Click on the List tab, and choose "Export to Excel"

 

Ccnnect to Export t 
Outlook Excel 
Open with Access 
Open with Project 
& Export 
Form Web Parts 
Edit List 
Customize in 
New Quick Step 
Customize List

 

 

 this will open a dialog asking you to either save it or open it, note this will not save or open an Excel file, it will open/save a .iqy file, which is a Web Query file, it will not contain any data, but it will hold a connection reference to your SharePoint list. You can choose to open it, and it will open in Excel, and Excel will ask you if you trust this source, for sure we trust it because it's coming from SharePoint, so click on Enable: 

 

Microsoft Excel Security Notice 
Microsoft Office has identified a potential security concern. 
File Path: 
Data connections have been blocked. If you choose to enable data 
connections, your computer may no longer be secure. Do not enable 
this content unless you trust the source of this file. 
Enable 
Disable

 

 

Now you'll see the data coming in Excel and it looks like this: 

 

Title 
2 Fictional Company 1 
3 Fictional Company 2 
Address Number of Projects Item Type Path 
MTL 
MTL 
5 Item 
2 Item 
sites/HaitiSchoolproject/Lists/Our Partners 
sites/HaitiSchoolproject/Lists/Our Partners

 

 

REMINDER: This is a .iqy file, it doesn't hold the actual data, it just gets the data from SharePoint and shows it to you, if you're offline, it will not be able to display your data. So what to do? We can save it as an Excel sheet now, click Control + S and save it somewhere on your computer. 

 

Now we have our Excel sheet with the data locally, so we don't have to be connected to the internet to see the data .. But .. How can we get the latest data from SharePoint? Suppose that I am collaborating with other people, and they add data to this list, and I have this Excel file on my computer and am too lazy to open the browser and check the updates, I can click on the "Data" tab, and hit Refresh: 

 

Page Layout 
her Existing 
Formulas 
Review 
Show Queries 
From Table 
View Power Pivot 
Connections A 
Properties 
Query • Recent Sources 
Connections 
Refresh 
Edit Links 
All 
Connections 
Get & Transform 
Title 
dress Number of Projects Item Type Path 
5 Item 
2 Item 
sites/HaitiSchoolproj 
sites/HaitiSchoolproj

 

 

But.. Yes, another but.. What if I am too lazy to keep clicking Refresh to refresh my data? I can click on Connections - Just beside the Refresh button, and choose Properties: 

 

 

Review 
View 
Power Pivot 
Connections Al 
Design Tell me what you want to do 
Show Queries 
From Table 
Recent Sources 
Transform 
Properties 
Refresh 
Edit Links 
All 
Connections 
Clear 
Reapply 
Sort 
Filter 
Text to 
Flash Remove Data Consolidate Relationships Manage 
Advanced Columns 
Fill Duplicates Validation • 
Data Tools 
Data Model 
Add. 
Remove 
pr erties... 
Refresh 
Manage Sets... 
Close 
What-I f 
Analysis 
Sort & Filter 
acts Item Type Path 
5 Item 
2 Item 
sites/HaitiSchoolproject/Lists/Our Partners 
sites/HaitiSchoolproject/Lists/Our Partners 
Workbook Connections 
Name 
Description 
Last Refreshed 
Locations where connections are used in this workbook 
Click here to see where the selected connections are used

 

 

Then I can choose: Enable background refresh, and specify that I want to refresh data when the file is opened: 

 

Usage Definition 
Refresh control — 
Last Refreshed: 
Z] Enable background refresh 
Refresh every 60 
IV minutes 
Z] Refresh data when opening the file 
Remove data from the external data range before saving the workbook 
Z] Refresh this connection on Refresh All

 

Click OK and close the Excel sheet. Let's try it out, add a new entry in the SharePoint list: 

 

 

Address 
Fictional Company 3 
Fictional Address 
Number of Projects 51

 

 

Then open your document again, it might ask you to Enable External Connections if it's the first time you open it after the previous configuration, so click Enable Content: 

 

SECURITY WARNING External Data Connections have been disabled 
Enable Content

 

 

Then the records added in SharePoint will appear in this document: 

 

 

Title 
Address 
Number of Projects Item Type Path 
2 
4 
Fictional Company 1 MTL 
Fictional Company 2 MTL 
Fictional Company 3 Fictional Address 
5 Item 
2 Item 
5 Item 
sites/HaitiSchoolproject/Lists/Our Partners 
sites/HaitiSchoolproject/Lists/Our Partners 
sites/HaitiSchoolproject/Lists/Our Partners

 

 

 

Now we don't need to see the last 2 columns, am going to highlight them and right-click then click Hide

 

 

 

Number of Projects Item TYE . 
5 Item 
2 Item 
5 tem 
Cut 
Copy 
Paste Options: 
Paste Special... 
Insert 
Delete 
Clear Contents 
Format Cells... 
Column Width... 
Unhide 
ject/Lists/Our Partners 
oject/Lists/Our Partners 
ject/Lists/Our Partners

 

 

 

Then save your document. That's it, now every time you open this Excel document, it will auto refresh from SharePoint and show you only the data that you need. 

 

We learned in this post, how to get data from Excel into SharePoint as a list, how to give an Excel sheet a Named Range. We learned that Importing Data from Excel will require Internet Explorer as the importing process will require a browser that supports ActiveX controls. We learned how to pull data from SharePoint as a Web Query file (.iqy), which is a file that just connects to SharePoint and doesn't hold any real data, and if you want to save the data, you can save this file as an Excel Document (.xlsx), and we learned how to get the latest data from SharePoint without having to manually asking for it. 

 

Client Side Rendering in Forms In Depth

 

SharePoint gives new capabilities that developers can use to do same tasks required in previous versions of SharePoint using client side technologies. The main capability introduced in SharePoint 2013 is CSR (Client Side Rendering). The most common used method for CSR way is to manipulate users data for fields or list views.. But what about forms?

Someone is going to say: “Yes, SharePoint provides JS Link property for list forms as well, so what’s new with it?” Well, there’s more into it. Let’s see what can be done in list forms and to what extent we have the flexibility to do the forms we want.

Here we have a list called Customers, with a new form that looks like this:

 

csr1

Now, we want to make this look different, so we’ll be using JS Link for that. If you edit the newform page, and edit the web part:

csr2

Then go to Miscellaneous, you will find three important properties there:

  1. Form Template Name
  2. JS Link
  3. CSR Render Mode

 

csr3

 

We know that with JS Link we will be able to add a JS file and manipulate our form’s design. We also know that CSR Render Mode being set to standard it tells SharePoint to renders the form using CSR, and setting it to Server Render will make it depend on XSLT for that. But what about Form Template Name and its ListForm value?

If you had experience with SharePoint customization from previous versions specially for forms, you know that SharePoint uses technique called: Rendering Templates. Which is a group of predefined templates SharePoint has and uses them to render its pages and forms. If you have an on premises environment, you can go to this path: SharePoint Hive\TEMPLATE\CONTROLTEMPLATES, you will find a file called: DefaultTemplates.ascx:

csr4

 

If you open that file, you will find many controls with the tag: <SharePoint:RenderingTemplate.. . If you search for ListForm, you will find that it’s actually a rendering template that SharePoint uses to render its forms. But the good thing to know is, you can use another value which is CSRListForm. But what’s the difference?

The difference is that ListForm renders everything for you from SharePoint, like the layout for the form, the label names and so on, so if you need to use JS Link to style your list forms while you are using ListForm rendering template, you would need to use jQuery to restructure your HTML. So what if we use CSRListForm instead? Your list form would look like the following:

csr5

It will only render the fields for you, no labels, no buttons, no spaces between fields, nothing.. just fields. So you will have a clean output that you can play with in JS Link as much as you like! That’s neat!

Now let’s add a JS Link property to a .js file and try to style our form, there’s a file that my friend Muawiyah Shannak created and posted on MSDN, you can download the JS Link file here: https://code.msdn.microsoft.com/office/CSR-code-samples-11-Fully-54ebcaa6

Here we are declaring the objects necessary to form our view:

 

Inside the viewTemplate function we have the following code:

 

As can be seen, we’re constructing the HTML for our form, for this article and on MSDN, we made it static just for learning and explanation purpose. You can do whatever technique you prefer to form the HTML.

Three things to note about this code:

  1. Note how we have {{placeholders}} for each field we want to add in our HTML.
  2. Note also the getSPFieldRender function, I’ll explain that later on.
  3. The input button has an onclick function = SPClientForms.ClientFormManager.SubmitClientForm(‘{{FormId}}’) . This will allow us to use the out of the box capabilities to leverage the submit action and handling validations in the form.

Back to getSPFieldRender, this will go look into the form for each field by its internal name, and will get this field’s HTML, which will be replaced instead of the place holders such as {{TitleCtrl}}. This happens by using the CurrentFieldSchema and drilling down to the Field’s HTML from the ctx.Templates.Fields, As shown below:

 

Now, when apply this JS Link to our list form, SharePoint will render the fields, and place them instead of our placeholders, it would look like below:

csr6

Without using any jQuery hacks, you can now apply your designs to your list forms with the use of CSRListForms.

Hope that gave more understanding to List Forms and CSR.

HTTP Service Is Too Busy Error!

An Error you may face is when you try to run a simple SharePoint Management Shell Command, it gives you an error saying :

The HTTP service located at http://localhost:(portNumber)/securitytokenserviceApplication/securitytoken.svc is too busy.

And no commands were working at all.

In this case check the Application Pool for the SecurityTokenServiceApplicationPool, you’ll notice it’s stopped, start it and try again.

Changing RSS Feed links Reference

If you used RSS feeds with SharePoint, and want to make a button where it will display an RSS for specific pages library, you will notice that title in the RSS will open the properties page for the page, not the page itself, so how to change the option?

Go to your “Pages” library, and click library settings in the ribbon, click on RSS settings, you will see a category called “Document options”, change the “Link RSS items directly to their files?” to yes

After changing this option, you’ll see the expected results.

Happy SharePointing

Managed MetaData Service Application Error

When you first install SharePoint and open Central Administration for the first time, you’ll be given two choices, either to run the configuration wizard and let SharePoint do the administrative tasks for you, or configure the farm yourself.

If you configure the farm yourself and decided to add the Managed Metadata Service, you would simply go to Application Management>> Manage Service Applications>> Click new and choose managed metadata service. The SharePoint will create the Service Application for you. So if you try to click on the Managed Metadata Service Application you will be presented with the following error:

The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.
To Solve this issue, go to Central Administration >> System Settings Tab>> Manage Services on server>> and notice the managed metadata web service, its not started by default. click start and go back to your service applications page and view your service application. Note you may need to wait fora minute so that the error will disappear and you can use the service application.

How to rename Add new item in lists.

There is a requirement that is requested so much to change the Add new item label in SharePoint lists to something meaningful. The good about these labels is that they have an ID that you can play with using JavaScript. Each of SharePoint lists has ID that is different from a list to another.

For the custom list you have the ID= idHomePageNewItem,  for document libraries it is = idHomePageNewDocument, you can know the exact ID using the IE developer tool or the Firebug in Firefox.

To change the label, use JavaScript, you get the ID of the anchor and change the innerText property. The code is like this:

 

document.getElementById(‘idHomePageNewItem’).innerText= “my new text”;

That’s it.

Configuration Failed – Failed to create sample data

I was trying to install SP Foundation on my Hyper-V machine, and I faced this problem:

createSampleData

After searching and searching online, some people mentioned activating services and trying to run the configuration wizard again, others mentioned navigating to Microsoft Office Servers folder, which doesn’t exist anymore in the RTM release of SP Foundation, but the same principle works for the RTM. All you need to do is to navigate to the following path:

c:Program FilesWindows SharePoint Services15.0Data, and you’ll find an Analytics folder with a GUIC appended to it. All you need is to share this folder.

Hope this helps someone out there as it took a while for me to resolve.

Styling your list views using Apptex

Here is a short video that will show you how you can style your pages using Apptex:

 

Templates available until now:

Tabs: 

tabs

 

Accordions: 

Testimonials: 

 

 

Events: 

 

Slider: 

 

 

Google Maps: 

 

Bing Maps: 

 

Styled Google Maps: 

customgooglemap

 

Quick View: 

quickview

 

 

Modern Tiles: 

ModernTiles

 

 

Pinterest View: 

pinterest

 

Line Chart: 

LineChart

 

 

Bar Chart: 

BarChart

 

Radar Chart: 

RadarChart

 

Polar Area Chart: 

        PolarAreaChart     

 

Now Apptex supports SharePoint on-premise in the new release. Please send us your suggestions for desired templates.

 

Microsoft’s Virtual Academy Initiative – Know it. Prove it

Quick info for people out there .. Recently Microsoft Virtual Academy has announced the introduction of Know it Prove it program, which is dedicated for technology enthusiasts who wish to learn more about their favorite technologies. The program includes 8 categories that you can choose your favorite area from, and a link to it was added to the home page of the MVA site: http://www.microsoftvirtualacademy.com/ .

For the moment, it seems just a challenge for yourself to be able to complete these courses, but later on, it seems it would be more than that, but it’s nice to see Microsoft has organized some learning paths for people to know where to start with their preferred technology.