Thursday, October 27, 2011

SharePoint Updates


Do not install SharePoint updates just for doing it.

In these days with a lot of devices running on software, people have grown a habit to clicking the update button on a monthly basis, everything from the PC/Smartphone to the TV. And I know from my own experience how easy it is to just install an update on a device without even thinking over what the update actually does. Because you expect it will do something good and magically make it better somehow.

In an enterprise environment this is not always true, there are so many different elements playing together. And sometimes the smallest change can break the servers. 

That’s why you should ask yourself some questions before installing updates:
  • Is there something wrong with my current Farm?
  • Does the update fix critical errors concerning services and features you use?
  • Do you need the new Features added?


If the answer to these questions are no, you probably shouldn’t install them at all. Why risk breaking a perfectly healthy SharePoint farm.

If you do need the updates, you should always test the update in a staging/testing environment that is close to a clone of your production environment before rolling it out on the production servers.  It’s easy to blame Microsoft for releasing updates that could break a farm, but they simple can’t test it for everything, there is so many different configurations, 3rd party code and integrations on the various farms out there.  

If you read the e-mail sent from Microsoft when requesting updates you'll notice they do mention this.


All I'm saying is that you should be careful with updates, they could potentially do more harm than good to your farm.

Thursday, September 29, 2011

SharePoint Search Center Basics

This post will touch the basics of setting up an Enterprise Search Center.

Setup SharePoint Search Service


1. Central Administration -> Manage Service Applications

2. Select Search Service Application and click Manage in the Ribbon.
(If its not there, create it from New in the Ribbon)

From here there are tons of different aspects of search that can be configured, but for now I'll focus on the pure basics. And that's crawl, without crawling there isn't much to search on.

Start with setting up a daily crawl, on the Quick Launch on the right there is a link to Content Sources. By default your local SharePoint sites are added. From Crawl Setting click Create Schedules, create a daily schedule for Full Crawl.


This can be done for incremental too, but should have a much higher frequency, maybe every 15 mins or so.

 You can start a Full Crawl right from the content sources by click on their drop down menu.

Adding a New Content Source


Lets say you have a file share with tons of documents, obviously that's what SharePoint is their for replace, but many still have it. Then you can add a File Share as a content source so its available from SharePoint Search.


Configure it:


Make sure that the user used to search have access to the file share, only read access needed.

Check Logs

Crawling generates logs that you can read to make sure their aren't any error etc. You can find the logs from the Quick Launch under Crawl Log.

Note: A common error when crawling SharePoint Sites when you have specified an URL in the search Start Addresses.


Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled.




A fix for that error is found at Sensoft2000 blog.



Create the Search Center


Now the pure basics is up, but its enough to use the Search Center. You have probably noticed their is an Search feature already on SharePoint sites, but they only search within the Site Collection. Even if you only have one Site Collection on your intranet it will still exclude My Site where search on people are done.

Create a new Site Collection from Central Administration:


This Site Collection could be used on its own and you can connect your other Site Collections to use this Search Center when you use the search included on all pages.

Configure Site Collections to use the Search Center:




Here is an example of how it will look after you have connected it.


Monday, September 26, 2011

Extend Web Application

Extending a Web Application is just a couple of clicks in Central Administration. Lets say I want an extranet for the portal.aune.local created in the previous post.

Extend the SharePoint - 80


Open Central Administration and go to Manage web applications:

 Chose the SharePoint - 80 and click Extend on the Ribbon:


Configure:

Note: I haven't used any different Security Configuration, so this only show how its done. But obviously for an extranet the SSL would be a choice to consider.


Configure DNS


Make sure to configure your DNS records, I have used a CNAME, but you could just use a A record too.





Just for good measure, Reload:



That's all, now you can access the site at extranet.aune.local.

Sunday, September 25, 2011

Network Load Balancing

In this post I'll cover the basics of setting up Network Load Balancing with the free Feature included with Windows Server 2008. The goal with this is that you can take one server down without the users noticing it, and of course to balance the load between them for best performance.

Read more about NLB on technet.

In this scenario I have two SharePoint 2010 Servers in one Farm (AUNE-SH01 and AUNE-SH02). And I'll set it up the cluster to use portal.aune.local at IP 192.168.2.105. 

First you need to activate the feature on both servers, this is done with Server Manager.

Install NLB

     Open Server Manager and add feature:

     Install the Network Load Balancing Feature



Repeat this on both servers


Configure the Network Load Balancer

This part can be done on either of the two servers.

1. Open the Network Load Balancing Manager:


2. Right-click the cluster node and click; New Cluster

 3. Type in the name of one off the servers and click connect:


4. Chose an IP for the new cluster, in this case 192.168.2.105 is used, just make sure its an available IP.


5. The parameter for the cluster I have entered a Full Internet name and changed the mode to Multicast.

6. Under the port rules you can specify ports that will be balanced, I didn't change this. But in a production environment you could for example balance port 80/443.


7. Now the cluster is in place and the second server needs to be added, AUNE-SH02. Right click the new cluster and click Add Host To Cluster.




Configure the DNS

You'll need a new record for the cluster, 192.168.2.105. 

Open the DNS Manager, find your Forward Lookup Zone and right-click and New Host:




Configure IIS Bindings

Not done yet, the IIS server needs to be edited on both servers to set correct bindings.

Open the IIS Manager, find your SharePoint site and right-click and then Edit Bindings...:


Edit the entry already there and change the host name to the new portal.aune.local:


Configure SharePoint
The final part, configure the Alternate Access Mappings. 

Open Central Administration and find Configure alternate access mappings under System Settings:
Edit Public URLs for your collection, this example the SharePoint -80 is used.

Change the Default value to http://portal


That's it, your should now be available to connect to http://portal.aune.local.

Note: Just to be sure, restart both IIS servers.


In a later post I'll cover failover clustering the SQL server.

Thursday, September 1, 2011

SPD Workflow: Get Quarter based on Date

From time to time you need some output data that are not obviously available in SharePoint Designer when using out of the box actions. Such an output was needed the other day, and it was setting which quarter the current item was updated. The quarter should be used for different aggregations. With only SharePoint Designer and OOTB actions it didn't look like an easy task, but it turned out it was.

What was need was an constant variable, constant in the terms of characters returned. After some testing on different return types I figured out that ISO Formatted always returns the same amount of characters. And with another OOTB action, the Extract Substring of String from Index with Length.

First create a variable of type String, in the example its called "finnMnd":


I have used a parameter of type Date, "Start Dato", this could be any field of type Date. And the Return field as should be ISO Formatted.















After that we need to extract the month, and the month is always starting on position 6 with length of 2.












We have the number for the month in the variable "finnMnd". Now its only needed to do some checks and set a variable to 1. Quarter  2. Quarter etc with use of the condition "If any value equal value".























Tuesday, August 30, 2011

Using the built in Overlay Media player in SharePoint

This is a simple and cool feature to add some impressing features to your site.

And it can be all done from a Content Editor Web Part if you like by using a <div> and the built in mediaplayer.js script shipping with SharePoint.

Here is an example on how it could be used:





Friday, August 26, 2011

Open Edit form directly from Content Query

Some background for why I wanted this. I had a content type for registration of different tasks, and for underlying reasons I needed to split it into different SharePoint Lists. I wanted an easy way for users to register some data for the "tasks". Anyway I thought about setting up a CQWP on the users "Dashboard" querying for all the tasks of the content type, and link it directly to an edit form created with InfoPath.

1.
Its actually pretty easy to do this, first you'll need a template set up in ContentQueryMain.xsl. Search for the OuterTemplate.GetSafeLink, and copy and paste it right below. Now all you'll need to do is ofc change the name of the template, I just named it OuterTemplate.GetEditLink:

<xsl:template name="OuterTemplate.GetEditLink">
 <xsl:param name="UrlColumnName">
	<xsl:if test="$UseCopyUtil = 'True'">
	 <xsl:value-of select="concat($RootSiteRef,'/_layouts/CopyUtil.aspx?Use=id&amp;Action=editform&amp;ItemId=',@ID,'&amp;ListId=',@ListId,'&amp;WebId=',@WebId,'&amp;SiteId=',$SiteId,'&amp;Source=',$Source)">
	 </xsl:value-of>
	</xsl:if>
	<xsl:if test="$UseCopyUtil != 'True'">
	<xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
	<xsl:with-param name="UrlColumnName" select="$UrlColumnName">
	</xsl:with-param>
	</xsl:call-template>
	</xsl:if>
 </xsl:param>
</xsl:template>

The only change made to template other than the name is the Action=, changed to editform, that's it.

2.
Now for using it in a CQWP you'll need to set up an ItemStyle to use it. Make a variable to use the new template.

<xsl:variable name="SafeLinkEditUrl">
   <xsl:call-template name="OuterTemplate.GetEditLink">
      <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
   </xsl:call-template>
</xsl:variable>

3.
And then its set to use with xsl:value-of.

<a href="" title="{@LinkToolTip}" 
      onmouseover="javascript:this.style.cursor='hand';"
      onclick="javascript:SP.UI.ModalDialog.ShowPopupDialog('{$SafeLinkEditUrl}');return false;">
          <xsl:value-of select="$DisplayTitle"/>
</a>