Wednesday, February 23, 2011

Simple ToDo List to Migrate MOSS to SP 2010

For starts its no simple process to migrate from MOSS 2007 to SharePoint 2010. That's because SharePoint is a robust application platform full of site collections, web apps, etc. with plenty of custom features, complications and potential incompatibilities with 3rd party products and user-driven customizations that are abnormal which may not migrate robustly. Nevertheless in order to remember the migration process I'm outlining here some of the key todos.

1. Make sure the existing MOSS 2007 farm is upgraded to the latest service packs and all system issues are resolved. Doing a migration to SharePoint 2010 won't make any issue magically go away. In fact it could just complicate matters.

2. Make the content databases in MOSS 2007 read-only. To set a database to read-only in SQL Server 2008 you open SQL Server Management Studio and use Object Explorer to connect to an instance of the Database Engine, expand the server, and then expand Databases. Select the database that you want to configure to be read-only, right-click the database, and then click Properties. In the Database Properties dialog box, in the Select a page section, click Options. In the right pane, under Other options, in the State section, next to Database Read-Only, click the arrow, and then select True.

3. Copy the .MDF and .LDF files for this database over to the new SQL cluster for the SharePoint 2010 farm in order to implement the content database for SharePoint 2010. In Windows Explorer, browse to the location of the .mdf and .ldf files for the content databases. Select the .mdf and .ldf files for the database you want to move and either copy or move them to the destination directory. In SQL Server Management Studio, open the source instance of SQL Server. Right-click the Databases node, point to Tasks, and then click Attach. In the Attach Database dialog box, browse to the location to which you transferred the .mdf and .ldf files, select the .mdf file for the database you want to attach, and then click OK.

4. Once the database has been restored then run the following command to configure the SharePoint farm.

stsadm -o addcontentdb -url -databasename -preserveolduserexperience true

5. Be sure to do a IISRESET because otherwise it'll look like garbage until the web server resets.

Friday, February 11, 2011

Not thinking about SharePoint just before a Tech Interview

Recently I had my last tech interview w/o directing the screener to my tech Blogs. In a nutshell the interview didn't go as well as it could've. The reason IMO was because I wasn't thinking about SharePoint just prior to the tech interview. In the future that's going to change. 1. I'll do some thinking/focusing on the specifics regarding the new opportunity. 2. I'll be sure to guide the screener to my Blogs.

I had been up since 5am and working all day in Visual Studio, solving IIS communication issues, looking at some class libraries that were having a problem integrating from SharePoint, helping some developers learn about the 4 key FeatureReceiver events & the reasons why you use try-catch in Activating/Deactivating and why you don't override the Installing/Uninstalling events, and solving some JQuery issues. So finally 5pm came and it was time for the phone interview.

The screener at the end said he was concerned that I didn't know much about Sharepoint. I asked why. He said because I didn't even know what the 6 pillars of SharePoint were. And he said that I didn't even know what the SharePoint web services are. He said it looked like I was just working on the types of projects that they don't do much of. I'm certainly not going to give out his name because I'm about the criticize him. IMO he obviously doesn't know how to do effective technical screens. The primary purpose of a technical screen is to validate the person's resume. Are they telling the truth? What types of skills do they have? And if you're hiring them for a position that's "perm" its especially important to find out what their aptitude is like and what things they want to do in the future.

BTW I did know what the 6 pillars of SharePoint were and what the SharePoint web services were. It was just a long day and I wasn't at my sharpest for the interview. And he never had specifically ask what the 6 pillars were.

In SP2007 the 6 pillars were: Collaboration, Portal, Enterprise Search, ECM, Business Process/Forms, Business Intelligence

In SP2010 the 6 pillars are: Communities, Sites, Search, Content Management, Composites, Insights

If I had spent the last 6 months being a SharePoint 2010 salesman then they'd probably be at the tip of my tongue. As luck would have it I've been focused on migrating some pretty complex/difficult applications from SP2007 to SP2010 so I haven't been thinking much about all the buzzwords. However I certainly have been deep in solving search/CM issues, helping site owners figure out wikis/blogs/tags/ratings/MySites/feeds, working with the Ribbon, javascript, integration, taxonomies, workflows, content types, records management, InfoPath, Excel Services, and Performance Point.

BTW see http://www.codebanking.com/articles/sharepoint/sharepoint-six-pillars.asp for a glance at the details.

The SharePoint web services are listed at http://msdn.microsoft.com/en-us/library/ee705814.aspx online.

For example, you can use the GetListCollection method in the http:///_vti_bin/Lists.asmx service to get a list of Lists\List XML nodes in an XML document whose ID/Title properties can be used to help me drill into a specific List object.

However I tend to prefer the more secure, compiled/fast alternative of accessing the Lists property of a SPWeb object I opened up directly with SPContext.Current (or indirectly with its site collection's SPSite object). I've learned with SharePoint that its vital to know how to do effective up-front analysis. That's because many tasks can be self-service, easily done by a site owner, or souped up together by an designer/analyst in SharePoint Designer. The harder stuff needs to be thrown into some sort of application. By default I'm opinionated on this. I prefer building robust ASP.Net user controls to throw into the controltemplates folder underneath the 14 hive (or 12 hive in SP2007 or SP2003). Then I wrap these using what I call the User Control Container Web Part (UCCWP). It has 2 custom properties called Control Path and Control Parameters. The Control Parameters property is a XML string which if set to "help" displays a 3-column grid in the content area listing all the parameters' names, example values, and HTML descriptions. The code for this is specified in the ascx.cs partial class method that implements the base class's HelpHtml method. Of course I've learned that I have to roll with the punches and check my ego at the door on any given engagement I'm working.

I also suppose it didn't help when I told him too much about my experience in customizing Microsoft's Application Lifecycle Management tools/components to integrate with SharePoint and other presentation layers such as traditional ASP.Net, WinForms, WCF, WPF, etc. because too many SharePoint developers think of TFS as being just Version Control like many people view SharePoint as being just a shared file system directory on the network.

Saturday, November 6, 2010

CMAP Presentations

Please see http://alex-tfs.blogspot.com/2010/11/cmap-presentations.html for the presentations I made on Application LifeCycle Management (ALM) and de SharePoint Control Container Web Part (deCCWP) for ASP.Net User Controls.

Saturday, September 25, 2010

Resources for 2010 Development

Click on http://tinyurl.com/2010move to download an ebook titled "Moving to Microsoft Visual Studio 2010".

Click on http://tinyurl.com/sp2010pptx to download 17 advanced developer training presentations on SharePoint 2010.

See http://tinyurl.com/sp2010apps for "Developing Applications for SharePoint 2010" where you can download a guidance documentation, detailed examples, and a reusable class library to help developers and architects make the right decisions and follow proven practices when designing and developing applications for SharePoint 2010. The guide has four core areas: application foundations, execution models, data models, and client models. It also includes eight reference implementations illustrating the core concepts covered in the guide. The reusable class library provides code to help developers build more manageable, flexible, and testable applications. Source code is provided for all reference implementations and for the reusable library. The reference implementations have automated setup scripts to configure the applications.

See http://tinyurl.com/sdk2010 for the SharePoint 2010 SDK. It includes documentation and code samples for Microsoft SharePoint Foundation 2010 and for Microsoft SharePoint Server 2010, which builds upon the SharePoint Foundation 2010 infrastructure. The documentation includes detailed descriptions of the technologies that SharePoint Server 2010 and SharePoint Foundation 2010 provide for developers, reference documentation for the server and client object models, and step-by-step procedures for using these technologies and object models and programming with them. This SDK also includes best practices and setup guidance to help you get started with your own custom applications that build and extend upon the SharePoint Foundation 2010 and SharePoint Server 2010 platforms.

Wednesday, September 22, 2010

InfoPath Form Services for SharePoint 2010 is Missing

Yesterday I was working with my new SharePoint 2010 development farm. I had an InfoPath form template (i.e. .xsn file) to deploy. I opened up SharePoint Central Administration and went to the General Application Settings page (i.e. generalapplicationsettings.aspx on the Central Admininstration site). I noticed that the "InfoPath Forms Services" section between "External Service Connections" and "Site Directory" is missing.

Obviously I didn't have the Enterprise version installed. So here's how I solved it:
1. Go to MSDN subscriptions - http://msdn.microsoft.com/en-us/subscriptions/downloads/default.aspx
2. Login and open/expand the Servers link in the left navigation to find the "SharePoint Server 2010" product.
3. In the content panel you'll see the "SharePoint Server 2010 (x64) - DVD (English)" product information display. Click on the "View" link of the "Keys" column. Copy the "Enterprise CAL" product key for use in step #7 below.
4. I opened up SharePoint Central Administration and went to the (i.e. upgradeandmigration.aspx on the Central Admininstration site).
5. In the "Upgrade and Patch Management" section click on the "Convert farm license type" link to bring up the Conversion.aspx page.
6. Enter in the new product key and convert to the "SharePoint Server with Enterprise Client Access License" edition.
7. Now go back to the General Application Settings page in SharePoint Central Administration and you should now see the "InfoPath Forms Services" section with its links.

CopyAppBinContent and Workflow Error with InfoPath Form

Kudos to David Stampfli of Microsoft on his valuable assistance solving this dilemma.

I deployed an InfoPath Form template (.xsn file) to a SharePoint 2010 farm and configured a form library to use this template for new documents. In the InfoPath form a call is made to a custom workflow. Everything appears to be configured correctly. But when I save the form I get the following primary error message:

"Unexpected WinWF Internal Error, terminating workflow Id# f7967a24-ee3b-4056-8513-61a10854058c"

An internal exception has the following message:
Unexpected System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Resources.[............].resources" was correctly embedded or linked into assembly "App_GlobalResources.nkxekvue" at compile time, or that all the satellite assemblies required are loadable and fully signed.


What happened? The page resource files weren't properly deployed to the Web Application on the Farm during the WSP deployment. In order to mitigate this issue we have the CopyAppBinContent command for STSADM. See http://technet.microsoft.com/en-us/library/cc261996(office.12).aspx for more. On the WFE I ran the following command to resolve this issue:

stsadm.exe –o copyappbincontent

Monday, September 20, 2010

Configuring Site Usage Reports

I noticed that my site collection administrators weren't able to see their usage statistics. The issue was that the "Enable advanced usage analysis processing" checkbox was unchecked on the SSP's "Configure Advanced Usage Analysis Processing" screen. Here's what needs to be done to resolve this issue.

1. Open up SharePoint Central Administration
2. Click on the link to the SSP site home page.
3. Click on the link to "Usage Reporting" under the "Office SharePoint Usage Reporting" heading. This is _layouts/SpUsageConfig.aspx on the SSP site.
4. You will be on the "Configure Advanced Usage Analysis Processing" screen. Make sure that both checkboxes for "Enable advanced usage analysis processing" and "Enable Search Query Logging" are checked. Then press OK.
5. Now go to each Site Collection's Features (i.e. _layouts/ManageFeatures.aspx?Scope=Site from the site collection root).
6. If the Reports feature is activated then deactivate it.
7. Now click the Activate button for the Reporting feature.
8. As data is collected the site adminsitrators can use _layouts/SpUsageWeb.aspx on their site to see their site's statistics.
9. As data is collected the site collection administrators can use _layouts/SpUsageSite.aspx on their site collection root to see their entire site collection statistics.

Monday, August 16, 2010

Branding, Design, Skinning, etc. for SharePoint 2010

Microsoft has sure done plenty to improve the look/feel and user experience in SharePoint 2010 over MOSS 2007, WSS, STS, etc. earlier editions of SharePoint. But alas there are always going to be people/groups who will want to spend money on more design customizations. To do so wisely I recommend the following procedures:

1. Think first. The proper term for site look/feel customizations in SharePoint is "branding". You also want your SharePoint 2010 "branding" to be usable long-term so stay tuned in to the key SharePoint 2010 branding strategies so you can have confidence that Microsoft will implement a migration path for future editions of SharePoint.
2. Make the focus of the design changes/implementations to be on the Master Pages. See http://startermasterpages.codeplex.com for a good starting point.
3. Read up on SharePoint 2010 branding. See http://www.sharepointpodshow.com/archive/2009/12/21/sharepoint-2010-branding-episode-40.aspx, http://www.sharepoint911.com/training/Pages/Branding2010.aspx, and http://community.bamboosolutions.com/blogs/sharepoint-2010/archive/2009/10/21/spc-customizing-amp-branding-my-sites-in-sharepoint-2010-with-heather-solomon.aspx to get started.
4. Understand the basics of what a WSP is. As you are building branding capabilities such as master pages, CSS, other stylings, etc. you will be doing so in SharePoint Designer, Visual Studio, Notepad, a CEWP or some other tools. Ultimately you'll want them all packaged up in WSP(s) for sustainability, maintainability, reusability, migrations, and collaboration. See http://www.bing.com/search?q=sharepoint+2010+WSP+%22Solution+Package%22 to get the latest info on WSP(s).

Wednesday, August 4, 2010

maxRequestLength and Large File Uploads for Web Server

I had an end user working with InfoPath Form Services in MOSS get an error when he attempted to load large attachments to his InfoPath document. Sure enough there was no httpRuntime tag in the machine.config file on the Web Front Ends (WFE), and thus no maxRequestLength attribute setting. The default value is 4096 which means 4096 kilobytes or 4 Meg. I upped it to 16 meg and the problem went away.

See http://msdn.microsoft.com/en-us/library/e1f13641(VS.71).aspx for technical specifications on the httpRuntime tag and its maxRequestLength attribute.

Here's a snippet of machine.config to demonstrate the concept.

<configuration>
<system.web>
<httpRuntime maxRequestLength=16384 />
</system.web>
</configuration>

You can locate the machine.config file in the MOSS WFE's .NET framework runtime's config directory within the Windows Microsoft.Net directory tree. In my case it was the C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Config directory.

Monday, August 2, 2010

Page_Load and OnLoad

Today I relearned an important lesson on the Page_Load and OnLoad event handlers for ASP.Net user controls. We cannot assume that they are one and the same in the page lifecycle. By default Visual Studio will create an event handler for Page_Load when you doubleclick on the designer panel for a user control.



This default behavior of Visual Studio set up a disaster in conjunction with my SharePoint development framework.

In my framework I've created a Framework.Base.BaseUserControl class that inherits from the System.Web.UI.UserControl class. The purpose of this BaseUserControl class is to serve as an ancestor class for all my user controls that get deployed with SharePoint solutions. In addition, the web part wrapper class (i.e. Framework.Base.BaseWebPart) assumes that the wrapped user control descends from this class.

Here's the OnLoad event handler in BaseUserControl.

protected override void OnLoad(EventArgs e)
{
this.MyBaseControlLoadLogic();
base.OnLoad(e);
}

Here's the result in Visual Studio for my user control.


protected override void Page_Load(EventArgs e)
{
base.OnLoad(e);
this.MyControlLoadLogic();
}


Everything compiles. But then all I got was a blank screen. I did some debugging and then discovered my mistake. The base.OnLoad(e) call im my Page_Load was causing a stack overflow that crashed my development web server. All I had to do was rename Page_Load as OnLoad.


protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.MyControlLoadLogic();
}

It worked :)

Thursday, July 29, 2010

Referencing the current user in SharePoint Code

In this example I'm making the assumption that you have a web page or web part hosted in SharePoint that is calling a user control with a C# codebehind (i.e. a .ascx.cs file). The code here is called in the partial class.

There are 2 object references available to use in gathering current user information:

System.Web.HttpContext.Current.User.Identity has a type definition of the System.Security.Principal.IIdentity interface.

Microsoft.SharePoint.SPContext.Current.Web.CurrentUser has a type definition of the
Microsoft.SharePoint.SPUser class.

In my code if my Active Directory account is adegaston on the domain called MyDomain then the output of the following function would be:

"Login:MyDomain\adegaston; Display:Alex Degaston."

private string SampleCode()
{
string loginName = System.Web.HttpContext.Current.User.Identity.Name;
string displayName = Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.Name;
string kFormat = "Login:{0}; Display:{1}.";
return String.Format(kFormat, loginName, displayName);
}

Colors are the Key to Asthetic Appeal

I found a great color chart at http://cloford.com/resources/colours/500col.htm to help me with the look/feel of websites.

Monday, July 19, 2010

Upgrading an Existing SharePoint Solution Package

If I already have a solution installed on SharePoint 2007 but I need to quickly upgrade it then I run the following script.

stsadm -o upgradesolution -filename mySolution.wsp -name mySolution.wsp -immediate -allowgacdeployment
stsadm -o execadmsvcjobs
stsadm.exe -o copyappbincontent
stsadm -o execadmsvcjobs


Note: replace "mySolution" with the solution's actual name.

Thursday, July 8, 2010

Post-Build Event Script in Visual Studio

When doing SharePoint development its good to choose on-the-fly whether I want to compile for the sake of making sure my code is compilable or to verify that my code deploys/activates successfully to a website. To accomplish this I've created a Post-Build Event script for my project as follows.


if $(ConfigurationName) == Debug GOTO DoDebugSkip
DEL "$(TargetDir)$(ProjectName).wsp"
"C:\Program Files\WSPTools\WSPBuilderExtensions\WspBuilder" -SolutionPath "$(ProjectDir)" -OutputPath "$(TargetDir)"

ECHO ON
call "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
gacutil /u $(ProjectName).dll
gacutil /i $(TargetDir)$(ProjectName).dll
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH%

stsadm -o deactivatefeature -filename $(ProjectName)\Feature.xml -url http://localhost/
stsadm -o execadmsvcjobs
stsadm -o retractsolution -name "$(ProjectName).wsp" -allcontenturls -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name "$(ProjectName).wsp" -override
stsadm -o execadmsvcjobs

stsadm -o addsolution -filename "$(ProjectName).wsp"
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name "$(ProjectName).wsp" -url http://localhost -immediate -allowGacDeployment -allowCasPolicies -force
stsadm -o execadmsvcjobs
stsadm -o activatefeature -filename $(ProjectName)\Feature.xml -url http://localhost/
stsadm -o execadmsvcjobs
stsadm –o copyappbincontent
stsadm -o execadmsvcjobs

iisreset
:DoDebugSkip

Monday, June 28, 2010

HRESULT: 0x80040E14

When attempting to add content to a List we got the following error "Exception from HRESULT: 0x80040E14". This error may occur when the file system on the data tier has run out of space. I used mstsc.exe to login to the server running SQL Server for this SharePoint farm and discovered there was only 500K left on the 40 gig C: drive. In SQL Server Management Studio I found the chief culprits were two log files hogging up approx. 23 gig and confirmed the files' location/sizes on the C: drive. I truncated both of them, this C: drive now has over 23 gig of free space, and this resolved the issue. Here's the command I used for truncating one of these log files.

USE SharePoint_Config
GO
ALTER DATABASE SharePoint_Config Set Recovery Simple
GO
ALTER DATABASE SharePoint_Config Set Recovery Full
GO
DBCC SHRINKFILE('SharePoint_Config_log', 2)
GO

Wednesday, November 18, 2009

Workflow for Sharepoint 2010

TFS 2010 and Sharepoint 2010 are quickly headed towards purchase and adoption by IT organizations of enterprises all over the globe. I'm determined to get up-to-speed on any changes to the Sharepoint Workflow functionality. I found a collection of videos at http://msdn.microsoft.com/en-us/sharepoint/ee513154.aspx to help techies get up-to-speed. However it takes 22+ minutes to watch all 5 videos so I planned an approach that should work in grasping all this new info. Here are my steps.

(1) See http://msdn.microsoft.com/en-us/library/ee537015(office.14).aspx for the latest in Workflow features for Sharepoint 2010.

(2) Go to http://msdn.microsoft.com/en-us/sharepoint/ee513154.aspx and click on the "Test your skills" button to really learn the main ideas to grasp.

(3) look at the code snippets at http://blogs.msdn.com/pandrew/pages/GettingStarted2010Snippets7.aspx,

(4) speed read through Paul Andrew's http://msdn.microsoft.com/en-us/magazine/ee335710.aspx article.

(5) Plan to return to http://msdn.microsoft.com/en-us/sharepoint/ee513154.aspx with your earphones during your lunch break to watch these videos.

And finally ....
(6) repeat steps 1-4 more carefully in order that you master the material.

A similar approach could be taken with the other 9 modules at http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx for getting up-to-speed on the Sharepoint 2010 platform.

Wednesday, July 22, 2009

ExecAdmSusJob

The ExecAdmSusJob command of the StsAdm utility is important to use in your Sharepoint deployment batch files.

Tuesday, April 21, 2009

MS-DOS script to remove a SharePoint solution

If you have a SharePoint solution (i.e. .WSP) that you'd like to remove then you could build a 4-step script to run in a MS-DOS script as follows. Just substitute the name of your .wsp file in both places here where it says MySolution.wsp.


"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o retractsolution -name MySolution.wsp -immediate -allcontenturls

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o execadmsvcjobs

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o deletesolution -name MySolution.wsp -override

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o execadmsvcjobs

Wednesday, February 18, 2009

Deploy a WSP without WSPBuilder using STSADM

For SharePoint development I typically use Visual Studio and WSPBuilder to do all my packaging/deployment of my code through .WSP(s). However its important to remmember the procedures for doing it directly through STSADM. At a DOS prompt you want to do the following:

1. Go to the directory where the .WSP file is located.

2. Add the directory containing STSADM to the DOS path.
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH%

3. Add the solution:
stsadm -o addsolution -filename AlexSolution.wsp
stsadm -o execadmsvcjobs

4. Deploy the solution:
stsadm -o deploysolution -name AlexSolution.wsp -immediate -allcontenturls -allowGacDeployment -allowCasPolicies
stsadm -o execadmsvcjobs

5. Activate the feature in the solution:
stsadm -o activatefeature -name AlexFeature -url http://localhost

What version of SharePoint am I running?

1. Find out your server name and the port number for SharePoint Central Administration. In my case its moss2007vm1 and 41819.

2. Go to the Settings.aspx page in the Layouts folder - i.e. http://moss2007vm1:41819/_layouts/settings.aspx

3. Look for Version under Site Information. In my case its 12.0.0.6219.

Which one?

MOSS 2007 or WSS 3.0 Cumulative update (KB956056 & KB956057) 12.0.0.6327
MOSS 2007 or WSS 3.0 Infrastructure Update (KB951695 & KB951297) 12.0.0.6318
MOSS 2007 or WSS 3.0 post-SP1 hotfix (KB948945) 12.0.0.6303
MOSS 2007 or WSS 3.0 post-SP1 hotfix (KB941274) 12.0.0.6301
MOSS 2007 or WSS 3.0 post-SP1 hotfix (KB941422) 12.0.0.6300
MOSS 2007 or WSS 3.0 SP1 12.0.0.6219
MOSS 2007 or WSS 3.0 October public update 12.0.0.6039
MOSS 2007 or WSS 3.0 August 24, 2007 hotfix package 12.0.0.6036
MOSS 2007 or WSS 3.0 RTM 12.0.0.4518
MOSS 2007 or WSS 3.0 Beta 2 TR: 12.0.0.4407
MOSS 2007 or WSS 3.0 Beta 2: 12.0.0.4017



Source: Penny Coventry's blog at http://www.mindsharpblogs.com/penny/articles/481.aspx