Thursday, December 2, 2010

Installing SharePoint 2010 Without Internet Access

Recently, I was forced to install SharePoint 2010 on a network without internet access. Due to the fact that SP2010 requires about a dozen prerequisites, this is much more difficult than it should be.
There is a way to set up the installer to not attempt to access the internet to download the prerequisites.
First, You'll need a computer that has internet access so that you can download the prerequisites.
Fortunately, someone did the work for me to do this part.
The SharePoint PowerShell script to download all the prerequisite files

SharePoint can be downloaded as an ISO from Microsoft. You'll need to get this and copy all the files into a directory somewhere. Put all the prerequisite files in the ""PrerequisiteInstallerFiles" folder.
This list assumes you are installing on Server 2008 R2. Server 2008 has some slightly different items and hotfixes

Next, create a file called: "PrerequisiteInstaller.Arguments.txt". Open it up in notepad and add:

/SQLNCli:PrerequisiteInstallerFiles\sqlncli.msi /ChartControl:PrerequisiteInstallerFiles\MSChart.exe /IDFXR2:PrerequisiteInstallerFiles\Windows6.1-KB974405-x64.msu /Sync:PrerequisiteInstallerFiles\Synchronization.msi /FilterPack:PrerequisiteInstallerFiles\FilterPack\FilterPack.msi /KB976462:PrerequisiteInstallerFiles\Windows6.1-KB976462-v2-x64.msu /KB976394:PrerequisiteInstallerFiles\Windows6.0-KB976394-x64.msu /ADOMD:PrerequisiteInstallerFiles\SQLSERVER2008_ASADOMD10.msi /Speech:PrerequisiteInstallerFiles\SpeechPlatformRuntime.msi /SpeechLPK:PrerequisiteInstallerFiles\MSSpeech_SR_en-US_TELE.msi /ReportingServices:PrerequisiteInstallerFiles\rsSharePoint.msi


NOTE: This should all be on one line! No New lines!


When you run the SharePoint setup.exe, it'll run the PrerequisiteInstaller.exe which will read the arguments file, and load the files from the prerequisites installer directory instead of trying to go to the internet!

Wednesday, November 10, 2010

Mapping Office Shared Template Location to a SharePoint Library

A user asked if you can create a new word document from a template that is stored in SharePoint.
Normally, i'd say sure, lets make it a content type, add it to the doc library and just click new! But of course this doesn't work. how many users really do that anyway? None of mine.

So, i found out there is a Word Workgroup Templates folder that you can set. When you click new, my templates, it will show you all the templates from that folder. It even creates tabs for the sub folders. Very nice.

To set the folder in Word 2007
  1. Word Options
  2. General -> File Locations
  3. Set the folder for Workgroup Template.
Unfortunatly, you can't just enter a sharepoint URL, or even the Shared folder path (\\portal\somesite\templates\). It will give you an error saying "You cannot use an internet address here. Enter a path that points to a location on your computer or on the network".

Solution:
Trick Word.

Map a drive to the SharePoint folder path. Then tell word to point to that folder.

I chose to map T:\ to \\portal\somesite\templates\ and then told word that my templates folder is t:\

Problem solved!

Friday, October 29, 2010

Programtically hiding SharePoint Document Information Panel in an Office Document

Using the Document Information Panel in SharePoint to show document information in Office can be very useful for users. I've used it to show information from a custom database inside of word so that users can find out what a document is about without having to visit the SharePoint site. This is very useful for when a user gets assigned a document from a sharepoint workflow.

The problem with this was that documents that did not connect to our Document Management system would not show any data. In a perfect world, the *special* documents would use a different content type so that using a different Document Information Panel would be easy. This was not the case in our system.

SO! How do you tell Word to hide the DIP when there is no data to show?

Microsoft has put together a nice post on how to do it: http://msdn.microsoft.com/en-us/magazine/cc500578.aspx

The problem is that this does not work. This requires you to have access to the Word API. When using a SharePoint DIP you only have the InfoPath API.

When the document loads, it attempts to get data from the database. The specific key to look-up data from the database is stored as a custom column on the document. Getting this is relatively easy, and many other blogs have written about it.

When the data key is blank(a document that someone uploaded to the Doc Library, not a System generated file), we are unable to get any data. I would like to hide the DIP in this case, but we can't!

Instead, I created a blank view. Then, in the OnLoad event, when the data can't be loaded, I set the default view to be the blank view. You could also do this the other way. Set the blank view as the default and then if data loads OK, set it to be your nice, pretty, data filled view.



The code to set the default view is simple:
e.SetDefaultView("Blank") ;

Where e is passed to you in the FormEvents_Loading parameter: LoadingEventArgs e


Problem Solved!
I also put a nice note on the data filled view that says the data was unable to load, just in case someone switches over to that view.

Friday, September 24, 2010

Getting Rows of data as a single column in a SQL query

Recently, I've been working on a Sharepoint Based document workflow solution that uses a custom SQL database. I ran into an issue where I needed to join a database table and get many rows of data back as one column in a query.

For example:
Table A:
ID, Name,

Table B:
childName, ParentID

where parent ID is table A.ID


I needed my results to be in the format:
A.ID, name, (childName1, ChildName2,ChildName3,....)


I found a few options,
One: http://www.simple-talk.com/sql/t-sql-programming/concatenating-row-values-in-transact-sql/

Provided about a dozen different ways to do it. All of them looked overly complex.

Then i stumbled upon:
http://johnnycoder.com/blog/2006/09/05/concatenate-multiple-rows-into-a-single-string/

which provided a simple Scalar function to return the results. I took that method and put together a SQL Scalar function to do it:

CREATE FUNCTION GetChildrenFromParent
(


@ParentID varchar(15)
)
RETURNS varchar(5000)
AS
BEGIN

DECLARE @ChildList varchar(5000)

SET @
ChildList = ''

select @
ChildList = coalesce(@ChildList + ', ', '') + childName from B where ParentID=@ParentID



-- Return the result of the function
RETURN @
ChildList
END
GO



Then my SQL to get the data looks something like:
select *,GetChildrenFromParent(id) as ChildNames from A

This returns results like:

1|Jeff| andy,mark,shannon

so, the one column is a comma separated list of rows of data from another table.

Thursday, April 22, 2010

How to make a film strip the default view for a Picture Library

Recently, I was trying to make a picture library for a customer to store their pictures in. I would prefer to use the film strip view as the default view because I think it is nicer looking.

The problem is that the details/filmstrip/thumbnails views are controlled via javascript, they do not change the URL when you visit the page and they cannot be set as the default view.

I found:
which has a pretty good description of how to fix this issue. Only problem is that the most important part, the javascript, is not visible!

I've decided to post it here so that it's easy to find.
<script>SwitchViewStyle('filmstrip');</script >
You'll need to add a content editor to the page, and add this javascript to it.

Make sure you add the content editor web part after the Picture Library View Web part. Otherwise, as the page loads, it runs the javascript before the Picture library exists and does nothing.

Thursday, September 24, 2009

What happened to my SharePoint Usage Analysis Logs?

Recently, I went to check my usage analysis logs and noticed that they were practically empty. No new data in weeks. I know that it was working before, but what changed? What's going on here?

I double checked that everything was enabled in CA, the SSP and in the site settings, and everything was still good. I also noticed that my Log location was D:\UsageLogs. I remember setting that up, so i went and looked at the logs. There was data, but only for the CA site. After some checking, I realized what was going on.

Make sure that all your App Pool accounts have Access to write to that location. For me, only CA had the correct rights. After giving the WSS_WPG and WSS_RESTRICTED_WPG and WSS_ADMIN_WPG groups Write permission to that folder, the logs immediately started filling up. No errors in the event logs were being created for me, or else I would have noticed this a long time ago.


Conclusion: Just give all your SharePoint accounts Admin access on your servers, it'll save you a LOT of headaches. Or, even better, just run everything under one account! HAHA, no, don't actually do this, but always check permissions when things aren't working as you expect.

Friday, August 7, 2009

Oh NO! I deleted a site that I shouldn't have!

There is no recycle bin for sites. You probably know this, or you or your users found this out the hard way. This has happened to me more than once, and is the topic of a previous post about removing the 'delete this site' link.

Let's stay that you haven't done that, and you don't have a nice SharePoint backup solution that will let you easily restore deleted content. A user has just deleted a site and has come to you to get it back.

Possible solutions:
Solution 1:
Copy your backups(you have those right? :P ) to another SharePoint server and create a new Web Application using that DB. That site should now have the content that you lost. Migrate it back over to your production portal.
This is a solution, but migration can be a pain the butt. Also, it assumes you've got backups. You'll lose all your version history, and information about created and last modified. If your site is small enough you might be able to make a template out of it and rebuild a new site from there. You might even be able to use stsadm to backup and restore. Both of those options will run into trouble if your site is too big or complex.

Solution 2:
Roll back the database to a time before this disaster happened. This solution will work if you don't have backups(I think) :) and everything will seem as if nothing happened. The down side is that you will have lost everything that has happened before the roll-back point. Hopefully you were alerted quickly to the problem.
First, make a backup of your transaction logs. if you already have backups, this should be enough. If you don't, you'll want to backup the site as well.
Next, Restore a Database. Give it a new name, and pick a time that you know to be before the problem happened(but not too far back or else you'll lose more data). Choose your live database as the place to restore from. You should see it list your backup's. If you didn't back up your transaction log, you'll only be able to restore to the last backup. That is why it is important to backup your transaction log before you start.
Once the restore is complete, you'll have a copy of the DB from before the problem happened. detach your production DB, and rename this restored copy to the production name. You should be good to go.
You may want to shut down the site when you do this so that no new data is uploaded, since it will be lost. If done correctly, you should be able to restore the site very quickly, but it depends on how big your content DB is and how much traffic you get.

Good luck! And now go delete the "delete this site" link from your _layouts/settings.aspx page so that users can't do this again in the future :P