Fabian Williams SharePoint Blog

Solving problems with SharePoint day and night

Meet Fabian Williams at the SharePoint Symposium Washington DC Renaissance November 17,2010

I will be part of a panel called “Stump the SharePoint Consultant” between 10:45 am to 11:30 am – Track 3 SharePoint Ecosystem

StumpTheConsultant_SPSympDC

I know a few of these panelist also and I am sure it will be a great discussion forum.  Looking forward to seeing you there.

 

 SPSympDC

October 27, 2010 Posted by | SharePoint 2010, SharePoint General, SharePoint How-To, Where is Fabian | | 1 Comment

SharePoint Template Question Revealed – Where is the Intranet Collaboration Template in 2010

Synopsis

So I am on a client site this week yet again and I am doing an Envisioning, ADS, and a SharePoint Intranet Base Install.  Now that I am about to talk Taxonomy and Information Architecture, we touched on just having a few sites to begin with so they are not overwhelmed,  but more importantly I only have a limited time on this project and there are quick wins that I can have by using that old Microsoft Office SharePoint Server (MOSS) templates called “Intranet Publishing Portal Template” which was under the Publishing Tab for Creating Sites. Now in SharePoint Server 2010 that Template is not in the GUI under that Tab, however you can get to it and provision a site using that Template using PowerShell

Disclaimer

I have seen a few conversations by folks in the community that I have great respect for taking the position of both using that Template for provisioning new sites in the SharePoint 2010 world v/s NOT using that Template and rather using the newer templates on Microsoft SharePoint 2010

Microsoft does have some guidance on it on the Technet Planning Sheet Sites

http://technet.microsoft.com/en-us/library/cc262410.aspx

Pay attention to the last paragraph on the page which reads in part…

“Some Microsoft Office SharePoint Server 2007 site templates, such as the site directory, news, and collaboration portal templates, are not available as an option in SharePoint Server 2010…These templates are also still available as options in the UI if the SharePoint Server 2010 farm is upgraded from Office SharePoint Server 2007. Otherwise use the social tagging features in SharePoint Server 2010 to get much of the functionality provided in these templates”

How To

SO here we go…

If you are provisioning a Site Collection for an Intranet Site in SharePoint 2010 “I have seen” where folks use Templates out of the Tabs of either of the below two screenshots below. There are several food for thought as to using one over the other; one way is to start out with a Blank Site and just activate the features you need accordingly.

clip_image001

New SharePoint Site

clip_image002

New SharePoint Site

Powershell to the Rescue

So you can, with three (3) commands gain access to the Template that you had in MOSS, see below for the command and execution

clip_image001[4]

Just to Verify; run the following command and look 9 from the bottom

clip_image002[4]

To actually provision the site you need to run yet another PowerShell command as indicated below which identifies the template of choice with the other parameters needed.

clip_image003

And BoooYaaaH you have your Intranet Collaboration Site Created in SharePoint 2010 with all the starter sites at your disposal.

clip_image004

 

In Closing

Remember I told you. Microsoft does not have this in the GUI for whatever reasons which means that I did above is probably unsupported or has issues buried somewhere, or maybe not. The truth of the matter is that I dont know.

Use at your own risk

I welcome any questions, comments, rants 🙂

 

Cheers!

September 21, 2010 Posted by | PowerShell, SharePoint 2010, SharePoint Administration, SharePoint How-To, SharePoint Migration | Leave a comment

I use Metalogix Migration Manager for Blogs and Wikis and here is why

Synopsis

If you have ever had to do any of the following…

  • Move an entire Blog site from one location to the next
    • Blog site Source may be from a different provider than the destination i.e. Blogger to SharePoint
  • Synchronize delta between blogs
    • You may have done an initial migration/move but for whatever reason, and now you have additional content on the source site in need of a move to the destination
  • Need to manage the Security and User Context when moving a blog site from source to destination

Then, as I did, you can use Metalogix Migration Manager for Blogs and Wikis.

In my situation, I hosted my blog on a public and free Blog Site when I started out.  The blog served me well over the years and allowed me to share my knowledge and experience in SharePoint and other related technologies. I was very fortunate to get my blog sponsored/hosted on FPWeb.net servers and on the SharePoint 2010 platform, however the challenge i faced was, how do I move all that work while preserving:

  1. Blog Categories
  2. Published Date – to maintain my Archive
  3. Blog Tags
  4. User Centric Data
    1. Who is the Blog Author
    2. What is that Authors’ role

I also wanted to be able to transition off one blog to another without abruptly turning off the proverbial faucet of information without adequate notice to my readers and subscribers. In order to do this, I performed an initial migration of ALL the content and then delta migration of just singular posts from time to time.

Metalogix Migration Manager for Blogs and Wikis allows for all the above and more.  Below you will find out how I used the tool, I hope that this helps you in your decision making for the same or related tasks.

Approach

So where do you get the tool… right here

clip_image001[4]

http://www.metalogix.net/products/Migration-Manager-for-Blogs-and-Wikis/

The installation of the tool is pretty straight forward and moving the entire blog/wiki or delta pages/posts as the come along.  Below is a screen shot where I am moving content between my source blog and my new SharePoint 2010 blog located at http://www.sharepointfabian.com

ScreenShotofTool

As previously mentioned, the tool has the ability to move content from a variety of Blog Content Sources into SharePoint. In my experience it will use the Object Model when you are local to the SharePoint Server and use Web Services when you are conducting the Migration Remote, for example, you have the tool installed on your workstation and both the source Blog and destination Blog are remote to  your location. Below is a screenshot of the various sources.

clip_image003[4]

A few options are there for customizing the migration experience. One particular on I would like to call out that was useful to me was the ability to “Configure global Mappings…” this allows me to create a mapping between source accounts and destination accounts. This assures me that the Author of my original blogs is maintained when the transfer is effectuated.

clip_image004[4]

Once you have connected to your Source Site, the migration is very easy. All you need to do Right-Click on the Source Blog and select “Copy Site” which copies all of the content for preparation to the Destination Blog. This option will move ALL content from one place to the other.

clip_image006[4]

Alternatively, you may only want to move specific Blogs, in that instance you Right-Click on the Source Blog and chose “Copy Pages” which applies ONLY the selected item for preparation to the Destination Blog. This option will move only that specific content from one place to the other.

clip_image007[4]

To copy the selected items to the destination it is as simple as just a regular Click for “Paste Blog Posts” and the process is kicked off

image

In addition to that you may create new Sites as a part of the Paste process which will spin up a site as well as copy/migrate the Selected Posts.

clip_image005[4]

The tool also has a great reporting/logging feature which runs and can be viewed while the blog migration process is under way.  On completed migration you may also elect to re-run that job which keeps the same parameters and criteria that was selected thus cutting down the time it takes to execute a job.

clip_image008[4]

Below is an example of what a Log File looks like when it is opened.

clip_image009[4]

 

In Conclusion

There are certainly quite a few tools out there that provide this service but in my professional life and in my personal life I use Metalogix Migration Manager for migrating content. The tool is excellent, the support is fantastic and the team of people on staff is friendly and very supportive.  If you have never used to tool, I encourage you to give it a shot.  On twitter you can follow @metalogix for the team and @cawood for the dude I always hit up when I need stuff 🙂

In fact, I will have to use the tool again to Migrate this Delta change to my SharePoint 2010 Blog Ha ha!

 

As usual, I welcome all questions or comments, Cheers!

September 20, 2010 Posted by | Metalogix, SharePoint 2010, SharePoint Migration | | Leave a comment

Fabian Williams WordPress Blog has been MOVED to http://www.sharepointfabian.com/blog

Please Bookmark my New Blog Site:

SharePoint Fabian – http://www.sharepointfabian.com/blog

For a period of 30 days I will post my Blogs on BOTH sites, but eventually i will taper off to my SharePoint 2010 Site being sponsored by FPWeb.net Thank you FPWeb; please follow them on twitter @fpweb or on Facebook http://www.facebook.com/#!/fpweb?ref=ts 

See my new SharePoint 2010 Blog

image 

Thank you all for following me on twitter @fabianwilliams and my corporate persona @adotobllc I really appreciate all the comments, critique, and suggestions.

Keep em coming!

September 9, 2010 Posted by | SharePoint 2010, Where is Fabian | 4 Comments

How To: Configure and Consume Kerberos for use in SQL Server 2008 R2 and SharePoint 2010 Part 2

 

Part 1: – How To: Configure and Consume Kerberos for use in SQL Server 2008 R2 and SharePoint 2010 Part1

Part 2: – Configuring Service Applications, Sites, and Verifying our Work

Part 3: – Test out Using Web Parts and Communicating Securely across Web Applications with Kerberos

 

Synopsis

In Part 1 we covered the installation of SQL, creating SPN’s for SQL, creating and configuring Service Accounts for SharePoint and the requite SPNs for SharePoint Service Applications and Web Applications.  In this Part 2 we will pick up from there an build out the following

  • Create, Configure Search Service Application
  • Create Kerberos Authentication Web Applications for
    • Intranet Site – Portal
    • Team Site – Teams
    • My Site – My
  • Create Site Collections for all three

Part 5: How to Make it Work

NEXT I WILL START CREATING SERVICE APPLICATIONS

MY FIRST ONE WILL BE SEARCH SO WHEN I CREATE MY SITES, THEY CAN ALREADY BE SQUARED AWAY FOR CRAWLING AND SEARCHING

So, right now my Service Applications is Naked.. lets get Search done first so when we create or Web Apps they will be added to the Content Source of the Search Service Applicaitons.

clip_image001

Screen clipping taken: 8/14/2010 11:29 AM

clip_image002

Screen clipping taken: 8/14/2010 11:39 AM

clip_image003

Screen clipping taken: 8/14/2010 11:49 AM

clip_image004

Screen clipping taken: 8/14/2010 11:51 AM

Now I will create my Web Apps for

  1. Portal
  1. Teams
  1. My

Right now the only Site is the Admin Site

clip_image005

Screen clipping taken: 8/14/2010 12:01 PM

We begin by creating a new Web App for our Portal

clip_image006

Screen clipping taken: 8/14/2010 12:03 PM

Change the Auth Provider to Kerberos

clip_image007

Screen clipping taken: 8/14/2010 12:04 PM

Create a new App Pool with the Managed Account that we have and already created the SPN for

Name your Content DB appropriately

clip_image008

Screen clipping taken: 8/14/2010 12:05 PM

Accept the other Defaults

clip_image009

Screen clipping taken: 8/14/2010 12:06 PM

Once you click OK you will get prompted about the use of Kerberos

clip_image010

Screen clipping taken: 8/14/2010 12:06 PM

clip_image011

Screen clipping taken: 8/14/2010 12:09 PM

Comfirmation is provided

clip_image012

Screen clipping taken: 8/14/2010 12:10 PM

Verify Auth Provider

clip_image013

Screen clipping taken: 8/14/2010 12:11 PM

Click Default

clip_image014

Screen clipping taken: 8/14/2010 12:14 PM

clip_image015

Screen clipping taken: 8/14/2010 12:14 PM

Now lets create a Site collection

clip_image016

Screen clipping taken: 8/14/2010 12:18 PM

clip_image017

Screen clipping taken: 8/14/2010 12:20 PM

clip_image018

Screen clipping taken: 8/14/2010 12:48 PM

And if all goes well

clip_image019

Screen clipping taken: 8/14/2010 1:22 PM

Let us now verify that Kerberos is what was used to get us to this point

We will use a variety of techniques

FIRST THRU IIS

clip_image020

Screen clipping taken: 8/14/2010 1:27 PM

clip_image021

Screen clipping taken: 8/14/2010 1:31 PM

clip_image022

Screen clipping taken: 8/14/2010 1:32 PM

clip_image023

Screen clipping taken: 8/14/2010 1:39 PM

You can also run Klist on the WFE

clip_image024

Screen clipping taken: 8/14/2010 1:56 PM

This is also what we have as far as Databases created so far based on our configs

clip_image025

Screen clipping taken: 8/14/2010 1:57 PM

clip_image001[4]

Screen clipping taken: 8/14/2010 2:07 PM

clip_image002[4]

Screen clipping taken: 8/14/2010 2:07 PM

clip_image003[4]

Screen clipping taken: 8/14/2010 2:08 PM

clip_image004[4]

Screen clipping taken: 8/14/2010 2:09 PM

DO THE SAME FOR the MySite

Then we should have the following Web Apps Created

clip_image005[4]

Screen clipping taken: 8/14/2010 2:18 PM

clip_image006[4]

Screen clipping taken: 8/14/2010 2:37 PM

clip_image007[4]

Screen clipping taken: 8/14/2010 6:01 PM

On the MySite turn on Self Service Site Creation

clip_image008[4]

Screen clipping taken: 8/14/2010 6:05 PM

August 15, 2010 Posted by | IIS, Kerberos, SharePoint 2010, SharePoint 2010 RTM, SharePoint How-To | 1 Comment

How To: Configure and Consume Kerberos for use in SQL Server 2008 R2 and SharePoint 2010 Part1

NB. In an effort to make this page load better I am breaking this Blog up into Parts, this is Part 1

Part 2: – Configuring Service Applications, Sites, and Verifying our Work

Part 3: – Configuring and Executing Search, Using Web Parts and Communicating Securely across Web Applications with Kerberos

Synopsis:

I felt a compelling need to write this blog post because with the advent of SharePoint 2010, a whole new world opens up for access to information. With that comes the challenge of managing access and security.  An area that I spend most of my time is in Business Connectivity Services (BCS) and one of the challenges that I personally face is with the “Double Hop”; whereby, I have a desktop client that is using a Web Front End (WFE) via SharePoint to connect to an SharePoint Server in an Application Server Role to in-turn retrieve and consume information from a Line of Business (LOB) back-end database, Kerberos mitigates that problem through its protocol handling and service delegation. Secondly, I have clients who’s desktop environment is heterogeneous in that they have a mixture of Windows XP [yes still XP], Macs running Safari, with a need to avoid login prompts for authentication.

My colleagues out there constantly here me asking for an ‘Authoritative’ document/guidance when it comes to standing up SharePoint 2010 Features.  After looking out there for something like that as it relates to getting Kerberos, i found quite a bit of information but nothing really end to end. I think that is because depending on your need, you may start in one area and end up in the next.  In this document my approach is:

  • A Brand New SharePoint 2010 Installation that will use Kerberos for the Authentication everything being x64
    • Active Directory built on Windows Server 2008 R2
    • SQL Server is 2008 R2

In my quest I pulled information from the following sites and fellow SharePoint mates

  1. There is a really good article that Kathryn Birstein turned me on to when I met her at SharePoint Saturday in New York a few weeks ago. It is truly the Holy Grail for Kerberos – found here — Configuring Kerberos Authentication for Microsoft SharePoint 2010 Products and Technologies (http://go.microsoft.com/fwlink/?LinkId=196600) (7.3 MB)
  2. For Registering a Service Principal Name for SQL Server I got a great piece of article here — http://msdn.microsoft.com/en-us/library/ms191153.aspx
  3. In terms of How to Implement Kerberos Constrained Delegation with SQL Server 2008 see this — http://technet.microsoft.com/en-us/library/ee191523(SQL.100).aspx
  4. Now, if you are going to be creating sites and you want them to be crawled, it suits you best to have your Search Service Application already configured before you create that Web Application; for that I checked out Bill Baer’s Twitter Handle: williamsbaer blog — http://blogs.technet.com/b/wbaer/archive/2009/11/23/step-by-step-provisioning-the-search-service-application.aspx
  5. Another good article that covers a good portion of SharePoint 2010 using Kerberos is here http://technet.microsoft.com/en-us/library/ee806870.aspx and it gives a good Scenario based example
  6. I also have a few Blog Post at https://fabiangwilliams.wordpress.com and my new SharePoint 2010 FPWeb Hosted Site http://www.sharepointfabian.com/blog which outlines how to Install and Configure SharePoint 2010, in light of that I take leaps over those items already covered and hope that you will use those blogs as a source of reference.The one thing I want to emphasize and it is a good segway into item number 6 is that I now DO NOT use the Farm Configuration Wizard (FCW) to create my service applications after a SharePoint 2010 Install; Spencer Harbar Twitter handle @harbars constantly preaches that unless you are doing a POC or a Demo Environment.. DO NOT USE IT… so I now dont. 
  7. The last two articles are from Spencer Harbar, in my opinion, one of the most Solid SharePoint gurus out there, I used his blogs for guidance not only in this example but for setting up User Profile Service which I also bring into this blog post — SharePoint 2010 and Kerberos and Rational Guide to implementing SharePoint Server 2010 User Profile Synchronization

So how are we going to work this and make it flow?

  • Create the Service Accounts we need for SQL and SharePoint
  • I used a GPO that my work colleague and MVP Aaron Tiensivu twitter handle @atiensivu to restrict NTLM traffic to servers so that if Kerberos wasnt successful then audits and errors would be thrown, I will call this out later on
  • Tackle Installing SQL Server 2008 R2 and getting Kerberos Working there first—why
    • we need Service Principal Names (SPN) set for the MSSQLSvc under the Service Account SQL Server is running under if we intend to secure our communications with SQL Server with Kerberos
    • I went further by limiting the Network Transport (Protocol Name) to TCP and Named Pipes because I know in in SQL Server 2008 / Windows Server 2008 enhancements have been made for Named Pipes and typically I use TCP for communications anyway
    • I tested this by logging onto the SharePoint box and using the SQL Management Studio to connect back to the SQL Box, run a query to see what the Network Transport is and also the Authentication Scheme
  • Install SharePoint 2010 bits and set the Authentication to Negotiate(Kerberos) – Configure for Kerberos thereafter
    • Create the Managed Service Accounts for the Web Applications and other Service Applications
    • Set the SPN’s for the Web Application Service Accounts for the Portal, Team, and MySites
    • Create the Web Applications, Site Collections, and validate that Kerberos is the method used for connectivity
  • More Test and Verifications

My Envrionment (Lab) – VMWare  on my Lenovo T61p [dual core single proc with 8 GB RAM]

  • DC Box
    • Windows 2008 r2 x64 Ent
    • Active Directory in 2008 mode
    • SQL 2008 r2
    • ArgoSoft Mail Server
    • 1 GB Ram Allocated
  • SharePoint Box (Application Role)
    • Windows 2008 r2 x64 Ent
    • SharePoint with all Service Enables
    • 3 GB Ram Allocated
  • SharePoint Box (Web Server Role)
    • Windows 2008 r2 x64 Standard
    • WFE Role Only (so I can really test kerberos from another box other than the app box)
    • 1GB Ram Allocated
  • Guest System
    • Windows 7 x86
    • 1 GB Ram Allocated

Yes… this is pushing it to the limit, in fact my CPU is pegged constantly and my memory is tapped. But I dont run with the big dogs out there with SSD’s and 16 GB RAM, not yet.. 🙂

Part 1: SQL Server Squaring Away

After Installing SQL Server 2008 R2, the fist step I do is manage the Protocols under which SQL Server will run, this time because I am focusing on Kerberos I am only enabling TCP and Named Pipes for the reason I mentioned above.  I also enabled a GPO to restrict and/or audit NTLM traffic between the servers as seen below

image

As seen below the service that SQL Service runs under is ADOTOBLAB\SqlSvc and this is what we will create a SPN for

clip_image001

Screen clipping taken: 8/14/2010 3:27 AM

clip_image002

Screen clipping taken: 8/14/2010 3:26 AM

Below is where we create the SPN for the MSSQLSvc under the service account; it is also best practice to do both the FQDN and the NetBIOS names when doing SPN. I used the command line tool for one and the ADSI Edit tool for the second.

clip_image003

Screen clipping taken: 8/14/2010 12:06 AM

Below we also use the tool to validate the entries made.

clip_image004

Screen clipping taken: 8/14/2010 3:25 AM

Part 2: Installation and Configuration of SharePoint 2010 (Accelerated)

Installation of the bits for SharePoint 2010 comes next, I just want to call out the differnces that you will do if you DO NOT use NTLM, see my other blogs for details on installation of SharePoint

clip_image001[6]

Screen clipping taken: 8/14/2010 2:27 AM

Here is your last chance to back out 🙂 — nah — so all this dialog box is telling you is that you need to make arrangements with the Domain Admins if you do not have the access to set up SPN’s for your Service Accounts that you will be using in the creation of Service Applications and Web Applications.

clip_image002[6]

Screen clipping taken: 8/14/2010 2:30 AM

clip_image003[6]

Screen clipping taken: 8/14/2010 2:30 AM

clip_image004[6]

Screen clipping taken: 8/14/2010 2:30 AM

clip_image005

Screen clipping taken: 8/14/2010 2:39 AM

Above is verification that you are using Negotiate(Kerberos) as the Authentication Provider in this Installation of SharePoint 2010

Part 3: Validate that Kerberos is working

FROM THE SHAREPOINT MACHINE AND USING SQL MANAGEMENT STUDIO I RUN THE BELOW TO TEST. THE KEY HERE IS THAT YOU ARE USING WINDOWS AUTH AND LOGGED IN AS THE SHAREPOINT INSTALL ACCOUNT

clip_image001[8]

FROM THE SQL BOX I CHECK THE EVENT LOG AND VERIFY

clip_image002[8]

 

Part 4 – Configure Accounts (Service Accounts, Managed Service Accounts) and Service Principal Names (SPN)

First Register Managed Service Accounts

clip_image001[10]

Screen clipping taken: 8/14/2010 10:15 AM

For User Profile Service and Search and just to Kick off Provisioning of UPS you will need to have Local Admin Righs set on a few accoutns

clip_image002[10]

Screen clipping taken: 8/14/2010 10:17 AM

Make sure that the UPS account also has Replicate Changes and Create Child Objects in AD

Next I am going to create A Records for my Sites (Team, Intranet and MySite )

clip_image003[8]

Screen clipping taken: 8/14/2010 10:30 AM

At this time I set SPN’ for the Service Accounts to be used for the Portal Site, Team Site and MySite. Again ensure that you do both NetBIOS and FQDN for SPNs

clip_image004[8]

Screen clipping taken: 8/14/2010 10:40 AM

clip_image005[6]

Screen clipping taken: 8/14/2010 10:40 AM

When Setting SPN’s ensure that you do both NetBIOS and FQDN

clip_image006

Screen clipping taken: 8/14/2010 10:42 AM

clip_image007

Screen clipping taken: 8/14/2010 10:43 AM

We do the same for :

  1. Teams
  2. My

However Teams and MY will be on port 4444 and 5555 respectively so we will do two entries because of a known issue with setting SPNS for SharePoint

clip_image008

Screen clipping taken: 8/14/2010 10:50 AM

clip_image009

Screen clipping taken: 8/14/2010 10:51 AM

clip_image012

Screen clipping taken: 8/14/2010 11:12 AM

Do the same thing for Service Account for the Team Site (svcAppPoolSites)

NEXT – Part 2

August 15, 2010 Posted by | Kerberos, SharePoint 2010, SharePoint 2010 RTM, SharePoint General, SharePoint How-To, SQL Server | 3 Comments

Error/Resolution: Could not load type ‘System.Data.Services.Providers.IDataServiceUpdateProvider’ from…

Synopsis: 

Cryptic message huh, but basically i got a tweet from @dfollette regarding using the Client Site Object Model (CSOM) in SharePoint to gain access to List Data and other LOB System and he also had a reference in a Web Cast to do the same thing using the REST API.  Even as tired as i was at 1:16 am in the morning it would just eat at me in bed, so i decided to review it before I tuck in.  However, when I tried to review the REST API by using a SharePoint Web Service I got an error…

The tweet was:

image

The Error was:

image

 

Resolution

So after a little research I found this blog entry “REST and SharePoint 2010 Quick Start Guide: Table of Contents” on Scott Currier Blog; and it indicated that you need to install install the ADO.NET Data Services Update for .NET 3.5 SP1 Depending on what flavor OS you are running you may need one over the other, the one i need was here because I am running WIN 2 K8 R2 http://www.microsoft.com/downloads/details.aspx?familyid=79d7f6f8-d6e9-4b8c-8640-17f89452148e&displaylang=en

Once you install it you will be prompted to restart.

image 

 

Trust but Verify

So after my reboot, let us now go to my SharePoint Site Collection and query the REST API again.

What i wanted to test was a little nugget I learned from the web cast…

image

You know come to think of it, I should have done a snapshot before running that update, but oh well, with finger crossed…

image

and it worked, lets drill down now

image

Looking at the XML you see the actual data..

image

July 6, 2010 Posted by | SharePoint 2010, SharePoint 2010 RTM, SharePoint Bug, SharePoint Development, SharePoint Error/Resolution, Strange Stuff | Leave a comment

How To: Create Content Types with Site Columns in Code Visual Studio 2010 for SharePoint 2010

Synopsis: So why would you Ever Ever need to feel the pain of creating Content Types from scratch and associate Site Columns also in code with them? Well, the one glaring reason is that if you create site columns and content types out of Code, you loose the control of assigning the GUID which is in effect the id designator of the object.  If you cannot control that, then as you move through a proper SDLC with a DTP environment, you in essence loose control over the same ID’s [objects] being the same across all the environment.  The second reason is that you have a clean and automated way to deploy your solution to any environment, inherently you could package and sell this solution if you wanted to.

So how do you do it?

Sahil Malk (@sahilmalik)has a great book in Building Solution in SharePoint 2010 and he has a great chapter on this topic. I used that as my premise for creating a full fledge Content Type with Site Columns to boot. Doing this in Visual Studio 2010 on SharePoint 2010 and the entire process to deploy is so easy now, even a caveman can do it.

Like Bud Light — Here we go!

First we need to start a new SharePoint Empty Project and start to build your solution out.

clip_image001

Next, and very appropriately, we are doing this as a Sandbox Solution because EVERYTHING we are doing for this effort will be in the Database, nothing will be on the File System. This is where you as a developer can do all the damage you want without worrying about the Farm Admin calling you saying “…hey dude, you brought down the server..” will never happen, sure you can bring down the Site Collection but hey, thats on you buddy..

clip_image002

Once you have your Sandbox Solution set, lets had some “SharePoint Items” first will be a Content Type

clip_image003

As you see below, I am calling mine AdotobClient. The idea here is that for my company Adotob, LLC, I am creating a Content Type that inherits from the Item Content Type which will hold Client specific data. The important thing here is that as a Content Type, this can  be used all across the Enterprise in any Web by anyone.  Build it once, use it many.

clip_image004

Once named, now your project will look like this.

clip_image006

As I mentioned before and as you will see below, everything in SharePoint inherits from a base, in this example I am inheriting from the Item Content Type, the wizard asks me to choose and i selected my choice

clip_image007

clip_image008

Now we will do some clean up. When you add the Content Type, you also get an elements.xml file created for the definition of the Content Type, now realistically if this content type is to be of any use, it will need Site Columns, but for now, we will just rename the elements.xml to something more descriptive.

clip_image009

clip_image010

So, this Content Type will have a few site columns to express what it is about the client we want to capture, it will be of many data types, text, date/time, etc. lets go and add an Empty Element which will be the Site Columns and populate the Elements.xml with the fieldtypes.

clip_image011

Before we do lets spot check what our Project looks like now.

clip_image012

As for clean up, lets rename the Site Columns elements.xml to a more representative name…

clip_image013

Lets us now flesh out the Site Columns, as you see below i am capturing all the necessary information one would capture about a client. Name, address, contact info, social content, etc. Below I use the Make Guid tool in Visual Studio to create those Field ID’s, and i with all my cut and paste, i screwed up the last entry, that type was to be a Text but i left it as date time.. oops.

clip_image014

Once we do that, we now associate those site columns via the GUID [Field ID == Field Ref] in what was the elements.xml of the Content Type

clip_image015

Once you are done, go ahead and build and deploy your solution. Oh make sure that you have Sandbox Solution Service turned on in the Central Administration before you do that, it is not on by default. Below if you inspected your Site Settings at the top level you will find the new Content Type

Trust but Verify

 

clip_image016

Click inside the Content Type, and you will find the site columns we defined.

clip_image017

Once we have done that lets spin up a new Custom List. We will include this content type in there and create an entry

clip_image018

To do that we need to manage content types…

clip_image019

We select the one we created and move it over

clip_image020

I also disabled the Item default content type what was there before so the only one that is an option is the one we created.. see below

clip_image021

Now we will make an entry for a new client

clip_image022

clip_image023

And our result is..

clip_image024

Voilla! you have a Content Type with Site Columns that you can manage NOT ONLY across the enterprise, but between Development, Test and Production Environment.

As usual, your comments, critique and questions are welcomed.

July 3, 2010 Posted by | Content Types, SharePoint 2010, SharePoint 2010 RTM, SharePoint Development, Site Columns, Visual Studio 2010 | 8 Comments

How To: Use SharePoint 2010 WebParts with a GridView Control to get SQL Image Data type and other Values

Recently I was faced with a challenge

  • Render a LOB System Data in SharePoint. Datatypes include an Image (BLOB) , char and int
  • Provide a means to filter by Last Name

Initial Approach

So as all professionals we should ‘Strive For’ the solution that can be done Out-Of-Box before trying to code a solution.  That said, I came up with a few ideas

  1. Use Business Connectivity Services (BCS)[yeah my one an only true SharePoint Love] to get this information, why, because it is in a LOB system and its SQL, and… well you get the drift: failing that
  2. Use a Visual WebPart in Microsoft Visual Studio 2010 arsenal of weapons, why, because I can just have the gridview auto create the columnd and be on my way: failing that
  3. Use a gridview control as part of a WebPart in Visual Studio 2010.. this is what won otherwise there would be a 4,5,etc….

The Gotchas

Well with the BCS approach; using SharePoint Designer 2010, we are not able to get the Image data type to come accross, much less map to an office property (a nice to have)

clip_image001

clip_image001[5]

Screen clipping taken: 6/29/2010 6:09 PM

clip_image002[6]

Screen clipping taken: 6/29/2010 6:20 PM

Now that we have put that to bed. Lets try some of our coded approaches.

    One approach that we could take would be to do a visual webpart with a gridview control on the page with "Auto-Generate Field" turned on; yeah, that was my first instinct too. However that will not work

    clip_image001[7]

    What will happen here is that the fields will in fact auto-generate however the only fields that will come across will be textual fields and of course our SQL Data Type is of type "Image". So in the end if you use exactly what we saw in our Business Connectivity Services example with SharePoint Designer 2010 visualized in an External List.

    Not to be dissuaded; my next thought was NOT to abandon the gridview control but to add a ‘Template Field’ and include an ‘Image Control’ inside with a reference to a HTTP Web Event Handler… sure this has to work, because I will explicitly stream the bytes in the Handler.ashx file and call it in the ImageUrl Property of the control….

    clip_image002[8]

    Yeah that wont work either because by the time the page [a User Control page ".ascx"], it is too far gone…. But a Visual Web Part would have made it sooooo eassyyyyy. But alas we have to look for another way.

    So your results will look like this….

    clip_image003

     

    The Solution

    Interestingly enough, the solution lies in all of the above with the exception that we cannot use a "User Control Page", we have to use an ".aspx" page. We will still have to use a HTTP Web Event Handler because we need to deal with the fact that we are pulling an Image directly from a SQL Database as a BLOB. So here are the steps I took

    Steps:

    1. Create an Empty SharePoint 2010 Visual Studio Project
    2. Add your Mapped SharePoint Folders for the _Layouts Directory as we are creating an Application Page. If you plan to add images too especially for your Feature, then go ahead and map the Images Folder also

    clip_image004

    1. Next in the same manner add an Elements Section
    2. When you are done, right click on your Folder within your mapped folder [coincidentally it will be the same name as your Project] and ‘Add a new Item’ which will be an application page.

    clip_image005

    1. I call mine "DisplayEmployeesWithPic.aspx" and this will create your page and your code-behind .cs file

    clip_image006

    1. So as it is an Application Page in our Visual Studio Template, it ready to go with the ContentPlaceHolders; we will be targetting the PlaceHolder for "Main" and wire-up our GridView and I am using a Button to add a filter.

    clip_image007

    1. We code against that in our code behind page to set our Datasource [which because I am a lazy developer, we will use the LINQ to SQL Data Connection], perform our query, data-bind and apply filter. You will notice below that I moved away from "Integrated Security" to "Standard Security" in my SQL Connection string because I met into two (2) specific problems (a) ‘Double Hop Problem’ when I ran the code from my Virtual Workstation and (b) Unless I had the End User to the LOB System, they didn’t have access to the dataset. I could have used Kerberos to solve my Double Hop issue, but I still would have the data access to deal with and I use that database to showcase my Business Connectivity Services / Secure Store [Single Sign-On] demos also, and how could I reasonably say that I am doing single sign on when I have folks there all willy nilly in the DB.

    clip_image008

    Screen clipping taken: 6/30/2010 7:42 PM

    1. The next thing we have to do because we are going after a non character data type in the SQL Database and trying to display it on a Grid View control is we need an HTTP Web Handler (a .ashx) file. This little code here is what intercepts traffic and steams the image to the image control previously seen in Step 5

    clip_image009

    1. Next we will add a Feature and ensure that the files are copied into the "Items in the Feature" section. The Elements .xml should auto configure it self also. You will notice I set the Scope to Site not the Default "Web".

    clip_image010

    Below are the options now in Visual Studio 2010 Teamplates

    clip_image011

    1. You Debug or Build and Deploy your Solution to the Farm. Yes, Farm, this cannot be done as a Sandbox Solution because it is touching the file system.

Trust but Verify Section

So that you can see that I have nothing up my sleeves [if you have ever sit in one of my Confrences or Speaking engagements, you know I always say and do this part] I will show you the results as is, then I will walk you through adding a recoredset and see the live results in SharePoint

  1. This is what we expect to see based on what is in the LOB System Now

clip_image001[9]

With a Filter

clip_image002[10]

Screen clipping taken: 6/30/2010 7:57 PM

  1. Next and in the spirit of the World Cup where Spain WILL / MUST WIN!!! (I now digress), we will add David Villa and the guy I so love to pick on; and yeah maybe it’s a little haterism, cry baby Ronaldo. Lets go get some stats…

clip_image003[5]

Screen clipping taken: 6/30/2010 8:00 PM (curtosy of Fifa.com) so I don’t get sued…

clip_image004[5]

Screen clipping taken: 6/30/2010 8:04 PM

clip_image005[5]

FIFA.com – 2010 FIFA World Cup™ – CRISTIANO RONALDO

http://www.fifa.com/worldcup/players/player=201200/index.html

Screen clipping taken: 6/30/2010 8:07 PM

clip_image006[5]

The Proof is in the pudding

clip_image007[5]

Hope this helps everyone who comes across it, as usual, your comments, critiques, and questions are welcomed.

June 30, 2010 Posted by | Business Connectivity Services, SharePoint 2010, SharePoint 2010 RTM, SharePoint Designer 2010, SharePoint How-To, SQL Server, Strange Stuff, Visual Studio 2010 | 5 Comments