SQL Server 2012 Named Instance Connection Error spautoinstaller

12 Nov

While running autospinstaller, one error we came across was:

Exception calling “Open” with “0” argument(s): “A network-related or instance-specific error occurred while establishing a connection to SQL Server

I grabbed the PowerShell from the AutoSPInstallerFunctions.ps1 file so i could try a few different connections.  The PowerShell that was failing looks like:

$sqlServer = “localhost\sharepoint”
$objSQLConnection = New-Object System.Data.SqlClient.SqlConnection
$objSQLCommand = New-Object System.Data.SqlClient.SqlCommand$objSQLConnection.ConnectionString = “Server=$sqlServer;Integrated Security=SSPI;”$objSQLConnection.Open()

So the obvious failing point is when we open the connection, so I tried using a whole bunch of aliases (we even created new aliases)  and different ways of calling our sql server instance name. Sauron is the server name at this stage.

.\
localhost
sharepointalias
localhost\sharepoint
localhost\\sharepoint
sauron
localhost\sauron

None of these worked in any combination. So we made sure that port 1433 was open on the firewall and checked other things that may affect the connection. After a bit of thinking and playing around Ryan realised that it may be our named instance that is causing the problem. SQL was installed with an instance called “SharePoint”. He eventually determined that named instances have a dynamic port number, so when allowing port 1433 on the firewall, this did not help our case.

The easiest way / the way we decided to fix this was to re-install sql server with the default instance, and walaa all our problems went away. But like I said this is a pretty lazy way of fixing this. To get around it you need to create an alias either manually (using SQL server configuration manager) or by adding it into the first xml item in your config xml for “DBAlias” like below, you will need to find out the dynamic port number for either of these cases.

<DBAlias Create=”true”
DBInstance=”sharepoint”
DBPort=”1846″ />    <—- random port number

Infrastructure and Software

12 Nov

Today I am installing SharePoint. Everything else has been set up by Ryan for me yay. Below is the basic infrastructure we have decided to go with, all servers have server 2012 as the OS.

1 Lync 2013 server

2 AD servers

1 Exchange 2012

1 SharePoint 2013

1 SQL 2012

SharePoint (a.k.a Sauron, 1 box)

All of our servers are going to have a lord of the rings related name. I chose Sauron for SharePoint as its massive and all seeing, also it is the main interface/portal users will be going to.

We are going to use autospinstaller to install SharePoint. This is an easy script to run, you just have to update some xml with your own details.

http://autospinstaller.codeplex.com/

I am doing a basic install of just SharePoint and the service apps, I will separately script the content databases, web apps and site collections if we need some (at this stage there will only be one site collection). Visual Studio 2012 will be used for development, so I will install that on my machine.

Issues:

Along the way we had an issue with named instances, “error occurred while establishing a connection to SQL Server“.

User Profile Service (UPS) – Running spautoinstaller the first time failed on the UPS, this may have something to do with the script originaly failing with our database connection issues. Once we sorted out our connection issues and rolled back and started the script from the start again it installed fine with no errors

Visual Designs

8 Nov

I’m a developer or consultant, either way designing isn’t usually my thing. But I thought it would be fun to come up with something for this intranet and our chosen “theme” to the design was going to be windows 8. The reason for the windows 8 type theme is that all of the IT students are going to be using windows 8, so it will go nicely and gives us some colours etc. to work with (instead of using the institutes colours).

So with my colours chosen for me already and a square theme, even I can design!

Home Page

Here’s the home page, as you can see its very square with lots of white space, and amaaaazing colours! love lots of colours…

Course Page

The other pages will have a left hand nav which will be orange, corresponding to the orange colour in the left side on the home page. There is also a grey bar at the top identifying the current site name, or course in this case.

Fun Zone

Simple 🙂

IT Support

A little more colour in this page in the recent issues. This will help users identify what has been resolved or not.

Now that the visuals are done, my HTML cutter uppera will cut this nicely for me to implement soon. So in the mean time I will finish the SharePoint install and start documenting what we need to implement for the solution, configuration wise (maybe do some powershell too yay).

Wireframing and More Requirements

6 Nov

After going over the requirements again I put together some wireframes using Visio. I decided to do 4: home page, course page, student fun zone page and the it support page. Below I will cover each of these pages with the information about what the components of the page should do.

Home Page

Header Components

  • Global navigation across site collection if necessary. This will be a one level hover over menu.
  • Search. People search and search this site will take the keywords and send the user to the search center.
  • MySite – this will take the user to their mysite so they can blog or look at what they are following etc.

Home Components

  • My Courses – Shows the courses the currently logged in user is taking. Clicking on these links will take the user to the course site under courses.
  • My Newsfeed – Shows the currently logged on users following feed. This shows the latest 5 or so.
  • Latest Course Documents – This shows the latest documents from all courses the student is taking.
  • Upcoming Course Events – Shows the upcoming events for all courses the student is taking.
  • Away Today – A rollup of who is away today. Items that include today in their from and to dates will be included, once the end date is met the item will drop off.
  • Tutor Tweets and News – A tabbed control that displays twitter posts from current tutors. The other tab is a rollup of news items from a news/blog site at the top level.

Course Page

  • Left Menu – A list of relevant links set up by the administrator. This should show links related to the home page and any sub sites for group assignments.
  • Course Outline – This is a text area for a description of the course. There is a link at the bottom which will link to the actual course outline which will be uploaded into the course documents library.
  • Latest Course Documents – This shows a rollup of the latest documents in this course.
  • Upcoming Course Events – Shows the upcoming events for this course.
  • Online Class Mates – Shows the currently logged on users that are in the same course.
  • Course Discussions – Shows the latest course discussion items. This is the main discussion forum, the other forums will not be rolled up here.

Student Fun Zone

  • Social Feed – Shows the latest discussion items.
  • Student Tweets – Users can add themselves to the feed or remove themselves.

IT Support

  • Recent Issues – Shows the latest modified issues with information around the status and category.
  • Request Help – Allows a user to directly add an issue from the home page.
  • How To – A list of how to’s with a rating and comments. (Not sure if rating is possible yet????)

The first stage of wireframing is complete, any additional changes I likely wont re-upload, but they will be visible in the visual designs which is next 🙂

Basic Starting Requirements

6 Nov

Requirements starts out with a notepad, pen and an attempt to not think about what may or may not be possible.

After jotting down notes for a while I have the base requirements from GISIT:

  • Home Page. Students need information rolling up.
    – This is a mix of personalised, course and tutor information
    – [Personal] A list of links linking to courses the student is logged in as
    – Personal] A newsfeed of the latest items relevant to what they are following
    – [Course] A list of the latest documents uploaded to the course sites
    – [Course] A list of upcoming course events such as exams or assignment due dates
    – [Tutor] Away today list of tutors who wont make class
    – [Tutor] A list of the latest tweets made by course tutors
  • Courses. Each course needs its own site to hold documents and events etc.
    – Information on the home page for a course will only be related to the current course
    – A course outline with plain text and a link to the full document
    – A list of the current courses latest documents
    – A list of upcoming course events
    – Currently logged on class mates for easy messaging and calling access (using lync integration)
    – Course discussion forum latest posts and comment numbering
  • Student Fun Zone. An area for student ideas and discussions that are unrelated to a course
    – A feed showing the latest discussion forum items with comment counts
    – A twitter feed where students can add their account for rolling up their tweets (or have a hash tag to get stuff to show up)
  • IT Support Page. Somewhere to get how to’s and ask for help.
    – A list of recently added issues with a status on where the fix got to and how many comments have been made
    – A box to add an issue directly from the page
    – A list of How to articles for common issues

From this information I can start putting together some wireframes by jotting down ideas first, then using visio to put them together in a tidier manner that can be used for visual design later.

The next post will show the wireframe first drafts.

The beginning!

6 Nov

I moved to a small city recently for a few months to relax and catch up on some things. One of these things is SharePoint 2013! My sisters partner works at a local polytech and they are wanting to implement a bunch of Microsoft products released recently, including SharePoint 2013. So this is a good opportunity for me to help out and learn SharePoint 2013 at the same time with a real case study. At each stage of the project I am going to blog about what we are doing and any issues we have come across, I will also mention things that I notice are different to SP2010.

I have renamed the polytech to Geeks in Suits Institute of Technology (GISIT) for blogging, all other implementation other than the name of the institute will be the same.

The Project

At this stage I only know bits and pieces of what is available in the new platform, so we are going head first into design with what we know so far and will tackle the challenges as we meet them.

Here is the structure I see this project running as:

  • Requirements (me talking to my friend and note taking)
  • Wireframing (probably wireframe around 4 screens to get a good idea of the system and for the visual designs)
  • Visual Design (Make stuff look pretty)
  • Somewhere around here do a SP install…
  • Somewhere around here put together some system/solution documentation
  • Implementation
    – Cut up the css
    – Create base structure of the Visual Studio solution
    – Masterpage and basic styling
    – Create site structure with Powershell
    – Create webParts and/or appParts (not sure which yet?????)
    – Create web templates (figure out if this is different)
    – Probably re-install the full version of SharePoint at around here….
  • Testing
  • Go Live in January 2013

There are a few bits and pieces in between the above plan such as figuring out search and things like Lync integration and other stuff that we haven’t foreseen at this stage.

Watch this space for the projects progress!

Crawling Publishing Images in SharePoint 2010

6 Jun

Publishing images cannot be used as crawled/metadata properties, you will only get empty results. The problem with this is that you may want to use images with search as a rollup for information using XSLT. There are a few tricks that you can do to get this data.

  1. Add another site column to the content type that is plain text and get the user to add the URL in. This can then be set up as another metadata property. This isn’t a very good option however as you don’t want the users having to fill in two columns for the same information.
  2. Add another site column to the content type that is plain text. You can then add an event receiver which grabs the URL from the publishing image and places it as plain text in the new site column. This can then be set up as a metadata property. This way isn’t a very clean way of getting the data as we need an additional field, and now some extra code that needs to run when we save the item just to get an image.
  3. Use page code behind to add a Meta tag in the header section of the page to hold the information we want to crawl. This option is quick and easy to implement if you have code behind.
  4. If code cannot be used you can add a Meta tag into the header section of the page layout itself. You can then read out the value of the publishing image into the meta tag content. This is the easiest solution as it requires three lines of code added into the page layout itself, so nothing compiled.
I am going to go through setting up step 4 as it is a really easy way of getting around this issue without any code, event receivers or additional fields.Assumptions:

  • You have a working Page Layout that you can edit
  • You have access the the Search Service Application
  • You have access to the search page to update the xslt

Adding the Meta Tag into the Header

  1. Edit your page layout in advanced mode in SharePoint designer, or open in visual studio
  2. View the page layouts aspx code and add the following head section below PlaceHolderPageTitle
    <asp:Content ID=”PageHead” ContentPlaceHolderID=”PlaceHolderAdditionalPageHead” runat=”server”> </asp:Content>
  3. Add the following meta tag in the new PlaceholderAdditionalPageHead. You will need to change the FieldName to the GUID of the publishing image field. If you don’t know the GUID, an easy way of getting this is to drag the field onto the page from the tool box under SharePoint controls > Content Fields.
    <meta name=’PageImageURL’ content='<SharePointWebControls:FieldValue  FieldName=”3de94b06-4120-41a5-b907-88773e493458” runat=”server” id=”ImageFieldUrl”/>’ id=”imageMeta” />
    Your code will look like:
  4. Save the changes.
  5. If you are using SharePoint designer go back out to the Page Layouts list and check in the new changes, publishing as a major version. You will then need to approve the changes to the Page Layout in the Master Page Gallery
  6. If you are using visual studio you will need to package the wsp and do an update
  7. Go to a page that is using the page layout and view the source. You will see a new meta tag with the image value in there

Setting up Search

  1. A crawl will have to be run before we can pick up the crawled property. Go into the search service application > Content Sources and run an incremental crawl.
  2. Once the crawl is complete go into MetaData Properties on the left hand menu under Queries and Results
  3. Click on Categories then Web. The meta tag we set up should be in here under PageImageUrl – the name we gave the meta tag itself
  4.  Now that we know the property has been crawled we can set up a metadata property which we can use with our XSLT.
  5. Go to Metadata Properties on the left hand menu and click on New Managed Property. Add the name you want the property to have, leave it as text, add a mapping to the crawled property “PageImageUrl” and allow it to be used in scopes.
  6. Run a full crawl to populate the new metadata property

Setting up the XSLT for the new property

  1. Go to the search page where the image needs to be shown and edit the Search Core Results web part.
  2. Edit the web part and add the following column to the Fetch Propertys
    <Column Name=”PageImageUrl”/>
  3. Edit the XSLT being used, either here in the web part by clicking XSL Editor, or in visual studio if you are deploying the XSLT
  4. Under the template where you want to display the image, add a variable
     <xsl:variable name=”pageimageurl” select=”testpageimageurl”/> 
    Then add in the code to display the image. We need to disable output escaping as the data we are grabbing is html, not just plain text. This will ensure the image gets displayed correctly
    <xsl:value-of select=”$pageimageurl” disable-output-escaping=”yes”/>
     
  5. Save the page.

You can now see the image that was saved in your results.