Wednesday, February 17, 2016

Simple Trick to Know Which SharePoint Server You Are On

Do you experience intermittent or inconsistent issues in your SharePoint portal? In some cases, this is due to one of the web front end servers not functioning properly. Here is a simple way to determine which server you are accessing.

1) On each of your web front end servers, create a whichserver.txt file containing the name of your web front end server.

2) In Windows Explorer, navigate to the "LAYOUTS" SharePoint hive location (ex. C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS for SharePoint 2013), and place your whichserver.txt file here.

3) In your browser, go to your SharePoint site and append the name of your text file (ex. "http://myportal/_layouts/whichserver.txt"). The name of the server you are accessing will be displayed.

That was easy!
Leo

What to Check if SharePoint is Down

If you're the administrator of your SharePoint farm, you need to know what to do if your farm goes down. Here is a list of the most common causes and what to do about them.

1) On you web front end servers, check the following:
     a) In IIS, are your SharePoint app pools running?
          If no, start them.

     b) In IIS, has your SharePoint site started?
          If no, start the site.

2) On all of your SharePoint servers, has the SharePoint Timer Service and the SharePoint Administration Service started?
     If no, start the services.

3) Are any of your service accounts locked or disabled? Could the passwords have expired recently?
     Try logging in to a server with each service account. do they fail to login? Or, if you have access to Active Directory, check if the service accounts are disabled and re-enable them.

4) On your SQL server, do you have available drive space left for your database files?
     SharePoint stops working if you run out of hard drive space. Free up drive space such as deleting old log files. You can also try shrinking your database in SQL, but this can cause fragmentation of your data. But, sometimes it is necessary when you have limited options.

5) In Central Administration, in the System Configuration page, do any of your server statuses say "Update Required"?
If so, a patch or update was installed recently that may have changed SQL schemas or application files, and the SharePoint Configuration Wizard needs to be run to get SharePoint fully upgraded and in-sync.

6) Can you ping all of your servers?
If not, diagnose the issue. Did firewall rules change? Is the DNS server available? Are physical connections okay? Did your SSL certificates expire? So on...

7) Did new server patches, updates, group policy rules, or a custom application get applied recently?
Verify what was installed, and research the possible affects to SharePoint for each. Rollback changes that may have broke SharePoint.

If none of these items fix your SharePoint farm, check the SharePoint ULS logs and the server's application and security logs for errors. They may point you to the cause of the outage.

I will follow-up this post in the near future with useful ways to gather and read SharePoint ULS logs using PowerShell.

Good luck!
Leo

Monday, February 1, 2016

How to Add a List or Library from Another Site in SharePoint

Have you ever wanted to display a list or library from another site in SharePoint? This article explains how.


NOTE: This only works for sites that reside in the same site collection.


1) In SharePoint Designer, edit the page that contains the list you want to display on another site.


2) In SPD 2010, click on the list/library web part in Design View.


- Or -


In SPD 2013, click on the code area that contains the list/library in Code View. (Design View is not available in SPD 2013)


3) On the SPD ribbon, in the "List View Tools" section, click on the "Web Part" tab.


4) In the "Save Web Part" section, click on "To Site Gallery" to create a web part of your list/library.


- Or -


Choose "To File" to save your list/library as a ".webpart" file on your local machine.







4) You will be prompted whether or not you want the web part to always show list data from the original location. Choose "Yes".




5) Close SharePoint Designer.


6) Go to the site you want to add the list/library, and Edit Page.


7) Click on "Add a Web Part" in the desire section of your page.


8) If you saved the list/library to the web part gallery, the new list web part will be in the "Miscellaneous" folder.


- Or -


If you saved your list/library to a .webpart file, click on "Upload a Web Part" and browse to your .webpart file on your local machine.


You should now see you list or library on your page with the same data.


Cheers!
Leo

Wednesday, January 20, 2016

How to Add a Shortcut Icon to your SharePoint Site



Do you want to add a custom shortcut icon (aka favicon) to your SharePoint shortcuts? Just follow these simple instructions.


1) Create an icon file. 
     a) Edit an image file in MS Paint
     b) Resize the image to 16x16
     c) Save the image as an .ICO file

2) Upload your ICO file to document or image library in your SharePoint site.

3) Edit your Master Page using SharePoint Designer.

4) Locate the following code:
    <head runat="server">

5) Add the following code after the line above:
    <link rel="SHORTCUT ICON" href="<URL TO YOUR ICO FILE>" />

    Example: <link rel="SHORTCUT ICON" href="/1stmlg/home/Images/usmc.ico" />

6) Save your changes. Your new shortcut icon will now appear for all pages that use your Master Page.

Cheers!
Leo

Thursday, December 17, 2015

How to Add a Google Map to your SharePoint Page

Do you want to add a Google map to your SharePoint page, so clients and colleagues can find your business or organization? It is easy to do.

1) Go to http://maps.google.com

2) Enter your desired location in the Search box and click the Search button.

3) Click on the "Share" link.

4) On the pop-up window, click on "Embed map".

5) Select a map size from the drop-down (optional).

6) Copy the auto-generated code from the pop-up textbox.

7) Add a Content Editor web part to your SharePoint page, and edit the web part.

8) Paste the code copied from the pop-up textbox into the Content Editor web part.

That's it!


Cheers!
Leo

How To Add a Weather Report to your SharePoint page

It's easy to add a live weather report like the one below to your SharePoint site.




Here's how to add the weather report:
1) Go to http://www.wunderground.com/stickers/ and follow the steps to create your "weather sticker".
2) The code to create the weather sticker will be emailed to you.
3) Go to the SharePoint page you want add your weather report to.
4) Click on "Site Actions -> Edit Page".
5) Add a Content Editor web part to your page.
6) Edit the web part, and click on "Click here to add new content".
7) In the ribbin under "Editing Tools", click on the "Format Text" tab.
8) In the markup section of the ribbon, click on "HTML -> Edit HTML Source".
9) Paste the code from Wunderground into the HTML Source window, and click "OK".
10) On the ribbon, click on "Save & Close".


Enjoy!
Leo

How to Create a Custom Greeting in SharePoint

Here a simple greeting you can create with the out-of-the-box Content Editor web part and some JavaScript. The script obtains the user's name from the SharePoint display name, and determines what time of the day it is to display the correct greeting as the following example.

Good morning, Leo!


Here's how to create the greeting. Add a Content Editor web part to your SharePoint page and add the following code to it:

<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(init,'sp.js');
var currentUser;
var title;
var trimmed;
var titleAry;
var currentDate;
var currentHours;


function init(){
    this.clientContext = new SP.ClientContext.get_current();
    this.oWeb = clientContext.get_web();
    currentUser = this.oWeb.get_currentUser();
    this.clientContext.load(currentUser);
    this.clientContext.executeQueryAsync(Function.createDelegate(this,this.onQuerySucceeded), Function.createDelegate(this,this.onQueryFailed));
}


function onQuerySucceeded() {
    currentDate = new Date();
    currentHours = currentDate.getHours();
    if (currentHours >= 5 && currentHours < 12) { greeting = "Good morning"; }
    else if (currentHours >= 12 && currentHours <= 17) { greeting = "Good afternoon"; }
    else if (currentHours < 5 || currentHours > 17) { greeting = "Good evening"; }


    title = currentUser.get_title();
    trimmed = title.replace(/^\s+|\s+$/g, '');
    titleAry = trimmed.split(" ");
    document.getElementById('userTitle').innerHTML = greeting + ", " + titleAry[2] + "!";
}


function onQueryFailed(sender, args) {
    alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
}


</script><div style="font-size: 14pt; color: green"><b><span id="userTitle"></span></b></div>


NOTE: The user's name is obtained by parsing the display name. In this code example, the display name format is "LastName Title/Rank FirstName MI". So, the third token ([2]) is used to obtain the user's first name. You may need to modify the code depending on your organization's display name format.

Enjoy!
Leo