Wednesday, February 27, 2013

SharePoint 2013: Listing All Installed SharePoint 2013 Products Installed

Ever since I found PhoeNIX Bird Networks blog post on listing out SharePoint products using PowerShell, I have been using variations of the commands to list out various installed products. During my latest installation repair, I realized that not all SharePoint products or components contain "SharePoint" in the name.

Therefore, I modified the commands slightly to produce a full listing of SharePoint-based products based on the product code:

$listApps=Get-WmiObject -Class Win32_Product | Where {$_.IdentifyingNumber -like “*90150000-*”}
$listApps | Sort -Property Name | ft -Autosize


Now, the listing produces a much larger and thorough listing of SharePoint components:





You may also view a similiar listing from Central Admin. Simply navigate to your SharePoint Central Administration site and on the main page under Upgrade and Migration, click on "Check product and patch installation status":

 
That brings you to the Manage Patch Status page and lists out the SharePoint 2013 Products on each server:
 

 

The default view is Farm, but you may use the View dropdown menu to select and isolate a particular server in your SharePoint farm.

 

SharePoint 2013: Repairing an Installation on a Web Front End

I was having issues with a particular SharePoint 2013 server in our stage environment. I was down to the point of uninstalling and reinstalling SharePoint 2013 but I decided to try a repair first. However, running a repair from Control Panel -> Programs and Features gave me an installation error as shown below and I could not move forward:


Error 1706. Setup cannot find the required files. Check your connection to the network or CD-ROM drive.

If you have the same problem - have no fear. We have a friend named "msiexec" which can be run from any command prompt including PowerShell. Simply open a command prompt and enter the following:

msiexec /f <install folder>\global\oserver.msi

This will perform a repair similiar to doing it from Control Panel -> Programs and Features for SharePoint Server 2013. The '/f' means to repair (fix comes to mind). There are other options that you may use with /f. You can always run msiexec /? to see the other repair options but I'll save you the trouble:

  p - only if file is missing
  o - if file is missing or an older version is installed (default)
  e - if file is missing or an equal or older version is installed
  d - if file is missing or a different version is installed
  c - if file is missing or checksum does not match the calculated value
  a - forces all files to be reinstalled
  u - all required user-specific registry entries (default)
  m - all required computer-specific registry entries (default)
  s - all existing shortcuts (default)
  v - runs from source and recaches local package

So /fp would repair and replace files only if they were missing. Issuing '/f' by itself is the same as '/foums' essentially.

That repair runs fairly quickly but there are other main installs that you can attempt to repair:

SharePoint Server 2013 (one from above)
msiexec /f <install folder>\global\oserver.msi

SharePoint Shared Components
msiexec /f <install folder>\global\shared\osrv.msi

SharePoint Foundation 2013 Core
msiexec /f <install folder>\global\wss\sts.msi

SharePoint Portal
msiexec /f <install folder>\global\sps\spswfe.msi

Search Server 2013 Core
msiexec /f <install folder>\global\search\osrchwfe.msi

If you have other components that need fixin', take a look in the global folder - most of the sub-folder names give a clue to what they contain.





 

Tuesday, February 26, 2013

InfoPath Not Showing Full Text in Drop-Down Boxes

Several users were experiencing a strange issue when viewing a certain InfoPath browser-based form from our intranet using IE9. This form has several drop-downs for a controlled start and end time creation. However, the values seems to be cut off for several people as shown below:

 
Resolution was investigated but that wasn't the case. I checked the browser zoom level - nothing. I verified compatibility modes - nada. I even tried checking F12 (Developer Tools) for CSS differences on the controls - nope.
 
I finally noticed that the Text size setting was set to Larger in IE9. I switched to Medium:

 
After switching to Medium, the form rendered fine:

 
It was a fluke thing and it only affected part of the form. Hopefully this may save people trouble if they ever run into this!
 

 

Bypassing the Office 365 Login to SharePoint Online using FBA via ADFS with SSO

Scenario
The current environment is as follows:
  • Office 365 is configured for SSO with ADFS 2.0
  • ADFS is running forms based authentication (FBA) using a custom domain (@mydomain.com)
  • Office 365 version is E3 Plan
  • SharePoint Online TeamSites is implemented and accessible via mydomain.sharepoint.com
  • Navigating to mydomain.sharepoint.com prompts the user for Office 365 login. Entering user@mydomain.com provides a link to login at the domain. Clicking the link presents the form to sign-in on the ADFS server


Desired Results
Present a link that will take the user directly to the FBA login and then authenticate them to SharePoint Online. Once logged in, SharePoint Online is presented via mydomain.sharepoint.com. There is no Office 365 login presented.


Solution
If you don't mind having a long URL (which can be easily added to an anchor tag in HTML), here is a solution for the desired results:

  1. Logout of Office 365, Windows Live, etc.
  2. In a new browser, enter the SharePoint Online address (e.g. mydomain.sharepoint.com)
  3. Enter a domain user (e.g. steve@mydomain.com) into the Office 365 login. A link appears to login to the domain.
  4. Click on the link.
  5. Copy the current URL from the browser and paste it into Notepad (or other text editor)
  6. Remove the &username portion in the beginning (e.g. &username=steve%40mydomain.com)
  7. The URL at this will work but I did see issues when having other people test it. Therefore, also remove "%252F%255Fforms%252Fdefault%252Easpx" that appears in the URL after the sharepoint%252Ecom (or whatever your .com is).
The resultant URL should be generic now and take users directly to the FBA form to login to SharePoint Online. The user must have a SharePoint Online license assigned in Office 365 as well as have Read access to the main team site.


 

Monday, February 25, 2013

SharePoint 2013: New-SPSite Error - The Authority/Host could not be parsed.

I was attempting to create a new site collection using PowerShell in SharePoint 2013. When executing the cmdlet, I received an error:

New-SPSite : Invalid URI: The Authority/Host could not be parsed.


I was logged into the server as the administrator so I thought I was good; apparently not. I needed to run SharePoint 2013 Management Shell as administrator to resolve the issue:

from start menu
 
from task bar
 

Sunday, February 24, 2013

SharePoint 2013: Image Preview in Search Results - Part III

This is the third and final post of the image preview series. Here is Part I and Part II.

I left off having a consistent search result from images both stored in picture libraries as well as a regular document libraries. The results show a preview on the page but the hover doesn't have a larger view. This is an easy fix.

UPDATE: Get the source files here

Showing a Preview Image in the Image Search Result Hover Panel


Problem
Hovering over the image search results does not show a larger preview image:

 
Solution
 

Modify the Item_Picture_HoverPanel.html file and add the following code right before the first if statement:
 
 <div class="ms-srch-hover-imageContainer">
       <img id="_#= ctx.CurrentItem.csr_id =#_" src="_#= $urlHtmlEncode(ctx.CurrentItem.Path) =#_" onload="this.style.display='block';" />
  </div>
 

Save the file and refresh the search results. A larger image shows in the hover now:


If you do not have a Search Center site collection and only see .js files, here is the modification to the Item_Picture_HoverPanel.js:

,'                <div id="', $htmlEncode(id + HP.ids.body) ,'" class="ms-srch-hover-body">'
,''
,'                        <div class="ms-srch-hover-imageContainer">'
,'                            <img id="', ctx.CurrentItem.csr_id ,'" src="', $urlHtmlEncode(ctx.CurrentItem.Path) ,'" onload="this.style.display=\'block\';" />'
,'                        </div>'
,'                '
);
                    if(!Srch.U.n(ctx.CurrentItem.PictureURL)){



 

Friday, February 22, 2013

SharePoint 2013: Image Preview in Search Results - Part II

This is the second post on previewing images in SharePoint search results. The first post is here.

In the first post I demonstrated a way to display image previews in search results and resolved two problems. But what about the images in a Picture Libary? I didn't see them appear in search results as pictures until I added the file types. Shouldn't there be special results for Picture types?

UPDATE: Get the source files here


Previewing of Images Stored In Picture Libraries

Problem #1: Images in Picture Libraries Returned as Files or List Items
After going through the steps in Part I , even images stored in Picture Libraries are returned as files themselves. The hover works fine but you should be able to take advantage of the image result type.

Solution to Problem #1: Copy and Configure the Image Result Type

In your Search Center site collection select Site settings from the settings menu:

Under Site Collection Administration, click on Search Result Types:


Scroll down and find Image. Use the drop-down menu and select Copy:


On the Add Result Type page, select Picture Item udner What should these results look like?


Click Save:
Run a search for an item in a Picture Library:



 
There is a preview image right in the results! That's great but that didn't happen in image results from other types of libraries - onto Problem #2.
 
Problem #2: Image Search Results Not Consistent
Now the results from a Picture Library and non-Picture Library look different. It is not consistent for the user:

Solution to Problem #2: Modify the Display Template for the Result.
This time you need to edit the Item_Picture.html file.

Simply add an else statement to the if in the middle of the code:

 else {
           ctx.CurrentItem.csr_PreviewImage = ctx.CurrentItem.Path;
      }


(If you only see .js files, the .js code to  modify is at the bottom of this post)

Save the file and run a search again:

 


Now all images that are returned have a preview image in the results!!!!

But now the hover is the Picture Library List item hover, not the one I modified in the first post. So in the next and last post of this series I modify that hover to include a larger preview!



If you are not running search in a Search Center Site Collection and/or you only see .js files in your Search Display Templates, here is the resultant .js code to paste over after the render header in Item_Picture.js:

    if(!Srch.U.n(ctx.CurrentItem.PictureThumbnailURL) && !ctx.CurrentItem.IsContainer) {
     ctx.CurrentItem.csr_PathLength = Srch.U.pathTruncationLengthWithPreview;
                    ctx.CurrentItem.csr_PreviewImage = ctx.CurrentItem.PictureThumbnailURL;
       }
      else {
           ctx.CurrentItem.csr_PreviewImage = ctx.CurrentItem.Path;
      }



 

SharePoint 2013: Image Preview in Search Results - Part I

I was discussing SharePoint Search previews of images on Twitter with Jasper Oosterveld . The discussion made me look into image previews in search results. As a result, I looked at various options and functionality to this regard. I am splitting these posts into at least two parts so I can get part of my solution out as soon as possible. This post solves the previewing of images that are not in Picture Libraries.

UPDATE: Get the source files here

Previewing of Images Not Stored in Picture Libraries

Problem #1: Image Search Results Are List Items

When images are stored in "regular" document libraries such as Site Assets, they are uploaded as documents. When the library is crawled, the results are the actual list item and not the image itself. Even if you add the Image or Picture content type to the library and modify the item, the result is still treated like a list item.

Solution to Problem #1:  Add Image File Types to Search
The reason the images are coming back as items is because image file types such as .jpg and .gif are not in the list of the search file types.

So you need to go to Central Administration and modify the Search Service Application. On the left hand side click on File Types:


On the File Types page, click on New File Type:



Enter an image file type such as jpg and click ok:



Repeat the process for other image types you want to handle.

Now go to the document library that contains the images and select Library settings from the Library top ribbon:


On the Settings page, click on Advanced Settings:


Scroll down and find the Reindex Document Library button and click it:

 
In the dialog that appears, click Reindex Document Library:

Click OK on the Advanced Settings page.
 
Now return to your Search Service Application and run an incremental crawl on the main content source:
 
 
After the crawl is completed, the search results of the images should appear as their filename instead of a list item. That solves that problem but the hover is still the Default hover template and doesn't show an image preview.
 

Problem #2: Image Search Results Hover Doesn't Show Preview
Now that the search is crawling image types, the results display the image file but the hover is using the default item template and no image appears.
  
 
UPDATE: You do not need to go through the modification of the default hover although I did in the beginning before I figured out all that was happening. The overall cause of this issue is that Image result type uses the Default Item template and not the Picture template. My solutions in Part II and Part III explain how do implement this better.

 
Solution to Problem #2: Modify the Default Hover Panel Display Template
The solution here is to modify the hover display template that is being used for default items. This can be easily performed using SharePoint Designer 2013. Follow the steps to get to the Display Templates as I have outlined previously.
 
This time, edit the Item_Default_HoverPanel.html file. Replace the RenderBody section with the following code:

                <!--#_
                    if(ctx.CurrentItem.FileExtension == "jpg" || ctx.CurrentItem.FileExtension == "gif"){
_#-->
                        <div class="ms-srch-hover-imageContainer">
                            <img id="_#= ctx.CurrentItem.csr_id =#_" src="_#= $urlHtmlEncode(ctx.CurrentItem.Path) =#_" onload="this.style.display='block';" />
                        </div>
<!--#_
                }
                else {
_#-->
    <div id="_#= $htmlEncode(id + HP.ids.body) =#_" class="ms-srch-hover-body">
                    _#= ctx.RenderBody(ctx) =#_
                </div>
<!--#_
                }
_#-->
          
 
 

You may add more conditions for each file type you want to handle. You could also check the content type however, by default, the images loaded to Site Assets are documents. So if you want to capture all images I would use the file extension check.

Save those changes and then perform a search. Hover over the image results:


Voila!!! The hover shows a preview of the image!!!

But that's not all folks. If you have Picture Libraries you could have even better results and previews but then that change will negate the solution provided here. I discuss this functionality and customization in my Part II post.




 

Saturday, February 16, 2013

Windows Azure: Accessing Your SharePoint VM from a Local Browser

If you have created a Virtual Machine in Windows Azure for SharePoint and would like to be able to access the SharePoint site from your local browser instead of on the server itself via remote desktop, just follow these simple easy steps to make it happen.

First navigate to your Windows Azure management portal and select the Virtual Machines:
 
Select the SharePoint VM top open up the Dashboard. Click the ENDPOINTS link:

 
At the bottom of the Endpoints screen, click on ADD ENDPOINT. The Add Endpoint dialog appears.

 
Click the Next arrow on the the first page of the dialog wizard:

 
Enter a name and 80 for the ports. Click the Complete Check button:
 


 
The VM is updated with the endpoint which takes about 30-60 seconds:



 

 
When the update is complete, a green check mark appears next to the name. When this happens, click on the DASHBOARD link to return to the VM dashboard:
 
 


Back on the VM dashboard page, locate and copy the public virtual IP address located on the right hand side of the page under the quick glance section:
 
Using Windows Explorer on your local machine, navigate to C:\Windows\System32\drivers\etc. Locate the Hosts file and double click to open. Open with Notepad.


 
Inside the hosts file, paste the IP address and add the host name. The host name could be the server name, a host header name, and/or your SharePoint root URL. 
 
 
Open a browser on the local machine and enter http://hostname. When prompted enter your SharePoint VM credentials (don't forget the domain name). Your browser should render your SharePoint VM root site collection accordingly:


 

Tuesday, February 12, 2013

SharePoint 2013: SQL Server Reporting Services Service Not Appearing in Services on Server


I previously went through the process of building a Reporting Services Server in SharePoint 2013 Integrated mode which I documented in my post here.

The database team decided they wanted another dedicated Reporting Services Server added to our staging farm. Fine. Sure. No problem. I have the steps documented and we should probably just follow the ones for the Report Server.

So we both did that and I could not see SQL Server Reporting Services Service under Services on Server in SharePoint Central Administration. So I thought something was wrong. I tried several different things and reinstalling/repairing SQL Server 2012 and SQL Server 2012 SP1. I was banging my head.

Then I realized..wait a second...didn't I run some PowerShell commands before?? Yes I did. I just forgot to include them in the original post (which I just updated anyway).

So if you do not see SQL Reporting Services Service running on the Report Server, you need to register and start the SQL Server Reporting Services on the server using PowerShell commands within the SharePoint 2013 Management Shell (on the Report Server):

Install-SPRSService
Install-SPRSServiceProxy

get-spserviceinstance -all |where {$_.TypeName -like "SQL Server Reporting*"} | Start-SPServiceInstance


 

Wednesday, February 6, 2013

SharePoint 2013: The license state for the current server doesn't match the farm's license state

PROBLEM/SCENARIO:

I needed to add a new server to our SharePoint 2013 staging environment. Upon running the SharePoint Configuration Wizard to connect to an existing farm, I received a Configuration Failed message:


Failed to connect to the configuration database.

The license state for the current server doesn't match the farm's license state.


I found a SharePoint 2010 blog post here that gave some insight. Essentially that post talked about reviewing the Properties column in the Config database and reviewing the Registry.

The properties in the database showed four (4) GUIDS:

<sFld type="Guid">ccd2be5b-dcb6-4fbe-8087-3e5c82244473</sFld>

<sFld type="Guid">52d457f6-ae45-4221-9bc5-1912a8861c00</sFld>

<sFld type="Guid">9ff54ebc-8c12-47d7-854f-3865d4be8118</sFld>

<sFld type="Guid">b7d84c2b-0754-49e4-b7be-7ee321dce0a9</sFld>

The registry also showed the same:


I figured that some of these should not be on there or that the new server did not have something. After some more digging I found a post on the MSDN forums here.

What that told me was that I was in the same boat and that there was some residue from SharePoint 2013 Preview version.The answer there was to rebuild the farm --- ahhhh. I didn't feel like going through all that trouble. That has got to be an easier way!!!


SOLUTION:

I found a way to determine which SharePoint products were installed by using the PowerShell code posted on the PhoeNIXBird Networks site here.


I figured out that all of the products that started with 2015 needed to be removed.

Therefore, I used msiexec /x along with each identifying number to remove the old Preview versions:


I had to repeat the process on each server that was currently in the "corrupted farm". I performed the same initial commands to make sure all of the old products were removed:


Next, I decided I should refresh the installed products on the farm just in case. That was also PowerShell but since it uses SharePoint cmdlets, I opened up the SharePoint Management Console to run the refresh:


This doesn't appear to do anything and is pretty quick.

Next, for good measure, I ran the SharePoint Configuration Wizard on the servers that I just removed the old Preview version from.

I was then able to run the SharePoint Configuration Wizard on the new server and have it join to the farm!!! Much less work than rebuilding the entire farm!!!