Apr 24 2014

Welcome to the ITcommUnity

 

IT Unity

I'm very excited to share with you the launch of IT Unity, an incredible new site that empowers individuals and organizations to solve business problems with technology. IT Unity is a community of trusted experts, users, business decision makers, IT professionals, developers, and industry solution providers--everyone who works with Microsoft SharePoint and Office 365 and is interested in sharing their knowledge.

At ITUnity.com, you'll find a site where you can:

  • CONNECT with world-renowned subject matter experts and peers in community-driven forums. Take advantage of experts' regular office hours and ask the questions. Gain invaluable insight through lively discussion of issues that community members are facing.
  • SHARE how you've solved a problem, created a service or product, or developed expertise. IT Unity's global audience and network of industry relationships will enhance your visibility and the impact you can make on the broader community.
  • DISCOVER how SharePoint, Office 365, and other technologies can drive innovation and business value. Find best practices, guidance, answers and lessons learned from experts and organizations that have tackled the challenges you face.
  • DEVELOP your knowledge, your skills, your reputation, and your professional network.

At the moment the main driving forces behind the IT Unity content are Dan Holme, Andrew Connell and Scot Hillier, but may other experts have already contributed content to IT Unity. I have been supporting the vision and goals of IT Unity since before it formed and I am planning to use the launch of IT Unity to start creating more content myself again as well. 

There are big plans for IT Unity and we would love for you to become part of this CommUNITY.
Today, as we launch, you'll find in-depth content from trusted technical experts and thought leaders, product and service providers, and exciting new voices in the tech community. You'll discover a new resource for asking questions, and getting answers from experts and peers. You can create and join professional networks and communities of practice. I hope to see you there!

To stay up to date follow @itunity01

Dec 27 2013

A good end to 2013 – Inside Microsoft SharePoint 2013 book printed and MCSM exam passed

I know, it’s been quiet here. There’s been a reason for that though, or more accurately two reasons.

I’ve been working on a book writing project and I’ve been studying really hard to pass the MCSM – SharePoint exam.

For almost a year I’ve been working on writing Inside Microsoft SharePoint 2013. Luckily I didn’t have to do it alone, because I can tell you, I would still be writing now. I had the privilege to be writing with a couple of really knowledgeable people and experienced writers. I have to say a special thanks to Scot Hillier and Ted Pattison for asking me to co-author the book, I was, and still am, honored! I really enjoyed the writing and would like to do more of it. I didn’t enjoy the deadlines as much though, so I’m not sure when I’ll attempt another writing project.
The book is the SharePoint 2013 version of the well known “Inside Microsoft SharePoint” series and like its predecessors it’s targeted at both new and seasoned SharePoint developers.

You can order the book from different web sites, like Amazon.

InsideMicrosoftSharePoint2013

As if the publishing of the book wasn’t enough to get me into a festive spirit, I also managed to pass my MCSM SharePoint exam. Even though the exams have been cancelled, people that had already taken the training, but not passed (all) the exams were allowed to (re)take the exam until the end of 2013. I wasn’t sure I wanted to invest the time needed to pass in a certification that didn’t really exist anymore, but after going back and forth for a month I decided that I wanted to prove to myself that I could do it by attempting to pass the last exam.
I’m very happy to be able to say that just before Christmas I got the email announcing that I passed and that I can now officially call myself an MCSM SharePoint.

mcsm

Hopefully having finished these two rather big projects will mean that I get some time to post here very now and then again. Let’s call it my first new year’s resolution..

Mar 23 2013

Coming up: SharePoint Evolution Conference

In a few weeks time the best and most fun conference of the year is coming up! It’s the SharePoint Evolution Conference in London. The conference is April 15 till 17 in the Queen Elizabeth II Conference Centre, right across from Westminster Abbey.
The conference organised by Combined Knowledge and is known for a great atmosphere, a very good group of speakers with great sessions, not just technical sessions, but also a lot of business oriented sessions and its great parties. The parties are said to be even bigger (is that possible), because it’s Combined Knowledge’s 10 year anniversary.

I am very happy that they allowed me to come back as a speaker again. I’ll be doing two sessions.

SharePoint Web Templates for on-premise and the Cloud
Web Templates provide a compelling deployment model for your custom SharePoint solutions both to an on-premise deployment and to Office 365. Learn about the key capabilities offered by Web templates and follow various samples which will demonstrate different deployment scenarios, along with best practices and common pitfalls of developing Web Templates.

Using Managed Metadata in custom solutions
Many of the features provided by the Managed Metadata Service Application (MMS) are extremely popular in Document and Records Management scenarios for the enterprise. Improvements to MMS in SharePoint 2013 further enable additional scenarios. As such MMS will be a common candidate for use in custom solutions.This session will dive deep into the development of custom solutions which leverage Managed Metadata features.

If you have a chance to go to this conference please do so, you won’t regret it.

EvolutionsBigBanner2013

Oct 12 2012

Upcoming speaking engagements

 

The SharePoint conference season is about to start again. With SharePoint 2013 coming out there is a lot of interesting stuff to talk about. I’ll be speaking at the following conferences:

SharePoint and Exchange Forum 2012 – Stockholm, Sweden. October 22-23
This is a very cool conference with both sessions in Swedish and English. I’ll be presenting two breakout sessions.

  • SharePoint 2013 Developer’s Mythbusters
    Audience: Developers
    Level: 300
    This session will talk about common misconceptions on developing custom solutions for SharePoint. The session will provide best practices about both “old” and “new” SharePoint 2013 development features, point out gotchas and dive into some IT Pro stuff a developer has to know about in order to be able to build solid SharePoint solutions.
  • Using Managed Metadata in custom solutions
    Audience: Developers
    Level: 300
    Many of the features provided by the Managed Metadata Service Application (MMS) are extremely popular in Document and Records Management scenarios for the enterprise. Improvements to MMS in SharePoint 2013 further enable additional scenarios. As such MMS will be a common candidate for use in custom solutions.
    This session will dive deep into the development of custom solutions which leverage Managed Metadata features.
    Creating and updating Managed Metadata fields both declaratively and programmatically will be covered, along with the eccentricities and best practices of the TaxonomyHiddenList and the different options for using Managed Metadata fields on custom web parts and pages.
SEF2012


SharePoint Conference 2012 – Las Vegas, Nevada. November 12-15
The “real” SharePoint Conference. This one is organised by Microsoft and it’s the biggest SharePoint Conference around. I will be presenting a single session here.

  • SharePoint Web Templates for on-premise and the Cloud
    Audience: Developers
    Level: 300
    Web Templates provide a compelling deployment model for your custom SharePoint solutions both to an on-premise deployment and to Office 365. Learn about the key capabilities offered by Web templates and follow various samples which will demonstrate different deployment scenarios, along with best practices and common pitfalls of developing Web Templates.

Print

SharePoint Connections Amsterdam 2012 – Amsterdam, Netherlands. November 20-21
The week after the SharePoint Conference in Las Vegas we’ll be in Amsterdam for SharePoint Connections. This is a very nice event where I’ll both be representing DIWUG, staffing the Ask the Experts area and presenting two sessions. The night before the conference, on Monday November 19th we will have a DIWUG event in the conference center. The event on the evening before the conference last year was a huge success with Dan Holme and Matthew Hughes speaking there. Keep an eye on the DIWUG site for announcements about this year’s event.

  • Using Managed Metadata in custom solutions
    Audience: Developers
    Level: 300
    Many of the features provided by the Managed Metadata Service Application (MMS) are extremely popular in Document and Records Management scenarios for the enterprise. Improvements to MMS in SharePoint 2013 further enable additional scenarios. As such MMS will be a common candidate for use in custom solutions.
    This session will dive deep into the development of custom solutions which leverage Managed Metadata features.
    Creating and updating Managed Metadata fields both declaratively and programmatically will be covered, along with the eccentricities and best practices of the TaxonomyHiddenList and the different options for using Managed Metadata fields on custom web parts and pages.
  • Effective Metadata Management for the Enterprise
    Audience: End Users/Business Decision Makers
    Level: 200 
    Managed metadata is a key part of any document or records management solution in SharePoint. Especially in a large scale environment it will help users to use consist terminology to categorize their documents and to later on be able to find those documents again. Coming up with the appropriate metadata and the right amount of metadata in a large organization is a common challenge and requires a solid process in which all stakeholders are involved to determine the metadata. Ongoing management of the metadata throughout the lifecycle can also be complex as you need to ensure that metadata in the system remains relevant, without causing problems for users with existing documents by deleting too much metadata.
    This session will cover common pitfalls and lessons learned from real world experiences of managed metadata in large organizations and the new capabilities in SharePoint 2013 to help with the ongoing management of metadata.

468x60 banner

I hope to see you at one or more of these events.
If not then you should definitely keep an eye on the MSDN and TechNet sites for SharePoint. A lot of SharePoint 2013 information has already been published there and a lot more is coming!

Jul 29 2012

Setting up your App domain for SharePoint 2013

 

The most important change in SharePoint 2013 for developers is the introduction of SharePoint apps. An app for SharePoint is a small and isolated application that provides a specific bit of functionality. SharePoint apps can and have to be added to or removed from a site by the site owner.  Apps have their own, isolated URLs, which are separate from the URLs of the sites where the app is being deployed to and where the app is being used. In order to provide isolation apps run in their own domain, instead of in the same domain name as your farm. Using a different domain name for apps helps prevent cross-site scripting between apps and SharePoint sites.
Each installation of an app has its own unique URL within the app domain. The app’s URL is based on a template “http://[app prefix][app hash].[app domain]/[relative site url]/[app name]. When you add an app to a site, a subweb of that site is created to host the app content. This subweb is not visible on the Site Contents page though.

Because apps run in their own app domain you will have to configure Domain Name Services (DNS) in your environment in order to be able to host apps. There is a page on TechNet that describes how to setup you DNS, but because it took me a while to get it all working I decided to write a step by step guide, which is what you’re reading now.

You can choose whether you want your app domain to be a subdomain of the domain that hosts the SharePoint environment (option B), or whether you want to create a completely new domain for your apps (option A). Creating a new domain specifically to host your apps in is a bit more secure, but it also requires a little bit more configuration. I will describe both approaches in this article. If you don’t have control over your DNS you will have to ask an administrator to perform these steps for you.

Option A: Create a new domain to host your apps in

  • Go to “Start”
  • Click on “Administrative Tools”
  • Select “DNS”

Open DNS

  • Right click “Forward Lookup Zones” and select “New Zone…”
  • Click “Next”
  • Keep the default and click “Next” again
  • In most cases, especially if your development server is in it’s own domain you can use the default on the next tab again and can just click “Next”
  • You now have to specify a zone name. It’s up to you what you choose here. My domain name is “solutions.com” and for my app domain I will use “solutionapps.com”
  • Click “Next”

New Zone Wizard

  • Click “Next”
  • Click “Finish”

DNS Manager

  • Right click on your new zone and select “New Alias (CNAME)…”
  • Fill in a * for “Alias name (uses parent domain if left blank)”
  • Click “Browse”
  • Double click on your server name
  • Double click “Forward Lookup Zones”
  • Double click the domain of your SharePoint environment. In my case this is “solutions.com”.
  • Select “(Same as parent folder)” and click “OK”
  • Click “OK”.

* Note that selecting the FQDN of the domain in here will only work in single server scenarios. If you are using more than one server you should be pointing to the DNS record of the web server in here. This is either the DNS A record for the web server, or the DNS record of the primary cluster address for NLB environments.

Create a CNAME

  • You are now done setting up your DNS and it should look like this:

DNS Manager

 

Option B: Create a subdomain to host your apps in

  • Go to “Start”
  • Click on “Administrative Tools”
  • Select “DNS”

Open DNS

DNS Manager

  • Right click on the name of your domain and select “New Alias (CNAME)…”
  • Fill in “*.app” for “Alias name (uses parent domain if left blank)”
  • Click “Browse”
  • Double click on your server name
  • Double click “Forward Lookup Zones”
  • Double click the domain of your SharePoint environment. In my case this is “solutions.com”
  • Select “(Same as parent folder)” and click “OK”
  • Click “OK”

* Note that selecting the FQDN of the domain in here will only work in single server scenarios. If you are using more than one server you should be pointing to the DNS record of the web server in here. This is either the DNS A record for the web server, or the DNS record of the primary cluster address for NLB environments.

Create a new CNAME

  • You are now done setting up your DNS and it should look like this:

DNS Manager

 

Configuring SharePoint

I’m assuming you already created an App Management and a Subscription Settings Service Application and that you already started the App Management and Subscription Settings services on your servers. If not this MSDN article will tell you how to. Note that you have to use PowerShell to create the Subscription Settings Service Application. There is no user interface for it.

Service Applications

Services on Server

  • Go to Central Administration
  • Click on “Apps” in the left side navigation
  • Click “Configure App URLs”
  • Fill in the URL of the app domain that you configured. If you choose to use Option A the url will be something like “solutionapps.com”, if you choose to use Option B it will look like app.solutions.com.
  • Fill in an app prefix. This can be anything you like, although it is best to keep this short. I used “app” myself.

Configure App URLs

Two example urls for two different apps on the same site are:
http://app-fef8493a3feb20.solutionapps.com/sites/apptest/[App1AppName]/Pages/Home.aspx
http://app-fef8493a3feb1d.solutionapps.com/sites/apptest/[App2AppName]/Pages/Default.aspx 
As you can see both apps have their own app hash, but both are in the same domain.

Beware of host headers

You are now ready to deploy your apps. Because of all this extra domain stuff though there are a few things you should know about your web applications and site collections.
If you are using a host header for your web application apps won’t just work for that web application. Because of how the redirect for the app domain works IIS will try to resolve the app url by using the default IIS web site, which of course doesn’t work. If you want to use host headers for your web applications you have to create an extra web application that is listening on port 80 (or 443 if you are using https) and that doesn’t have a host header.
This means that you have to create a web application like you normally would. You have to make sure that you select port 80 (or 443 if you are using https) and you should not fill in a host header. Note that you have to stop the Default Web Site in IIS in order to be able to do this. The web application will use the server name as its url. The web application can be empty except for a root site collection.

Another option is to use web applications without host headers and to create Host Header Site Collections. Be aware that Host Header Site Collections cannot be created via the user interface, they can only be created by using PowerShell.

Jun 20 2012

Save Site as Template and Document IDs

Once users get comfortable with using SharePoint they might go ahead and create their own solutions by clicking them together through the user interface or SharePoint Designer. If they put a good amount of work into putting something together they might want to reuse the solution. This makes sense, if you can save yourself the time and annoyance of having to do the same work more than once then why wouldn’t you. As you probably know you can save sites as templates if that site doesn’t have the publishing features activated on it.

As a side note: never save a site that has the publishign features activated on it as a template. Not even if you know the direct url. And don’t disable the feature first, create the template and then reenable it. It’s unstable and there is a very good chance of serious problems occuring on sites that were created based on these templates. I have seen it several times and the only solution is to throw away the sites to start over again. Compared to having to recreate a site and migrating all data that users put in there, including the fact that users can’t use the site and get to their data in the mean time, letting a developer spend a little bit of time to create a reusable template containing a publishing feature all of a sudden seems a lot more efficient.
Anyway, that is not what this post is about.

If you or a user saves a site as a template a .wsp file is created by SharePoint. The .wsp file contains the files and configuration settings to create a new site based on the template of the original site. The configuration is stored in XML files. Some of the settings that are stored are those related to Document IDs.

How do Document IDs work?

The document ID feature in SharePoint 2010 adds an ID to all documents in a site collection. The ID is unique within a farm and is build up according to the following schema: [[DocumentIDSitePrefix]]-[[ListID]]-[[ItemID]].

  • The document ID prefix is generated by SharePoint when a site is created. This ID is unique within the farm. Microsoft doesn’t guarantee that it’s unique across farms.
  • The list ID is an ID that is assigned to a list or library within the site collection. The first list that is created is 1, the second list or library is 2, the third one is 3…etc.
  • The item ID is the ID of the file in the library. The first file that is added to the library has an ID of 1, the second file is 2, the third file is 3. If a document is deleted the empty IDs are not reused.

The document ID is used to create a persistent url for the documents in the site collection. The url is [SiteCollectionURL]/_layouts/DocIdRedir.aspx?[[DocumentSiteIDPrefix]]-[[ListID]]-[[ItemID]]. If a document is moved from one library to another, or from one site collection through another using SharePoint functionality like the content organizer the document ID won’t change. A copy of a document gets a new document ID assigned to it. The DocIdRedir page uses search to find the exact location of the url. The user is then redirected (hence the name of the page) to the actual document url. If no results are found for a certain document ID, or if more than one results is found the search reults page is displayed with either the message that no results were found for a certain document ID, or with the list of results with a certain document ID. Seeing as SharePoint makes sure that no document ID prefix can exist twice in a farm and that the lists and documents are assigned unique numbers it should not be possible for a document ID to exist twice in a farm.

So what’s this post about?

So why write all of this down?
If a site is saved as a template the configuration of that site or list is stored in several XML files. In the case of a site that is saved as a template one of the elements.xml files contains the property bags of the rootweb, all sub webs and libraries within the site collection. Unfortunately in the property bag of the rootweb it also stores the following property: “docid_msft_hier_siteprefix”. In other words the document ID prefix of the site collection is stored in the .wsp file. If a site is created based on this template the prefix from the elements.xml file is used. In other words there are now two sites that have the same document ID prefix.
In the property bag of a library the docid_msft_hier_listid property is stored. This property stores the list ID of the library and that same list ID is used when the library is created within a site that was created based on the template.

docid_msft_hier_listid

 

docid_msft_hier_siteprefix

The Result

If a new sub site would be created based within the site collection that the template was created in originally the DocumentSiteIDPrefix will naturally be the same for the sub site created based on the template as it is for the rootweb and all other sub sites. This is by design, there is only one document ID site prefix per site collection. However the libraries will all have the same ID as they had in the original sub site(s) that was saved as a template.This means that all documents in those libraries will get the same document IDs as the documents in the original libraries had. And this of course defeats the purpose of the unique and persistent url that the Document ID functionality is supposed to provide.

If a new site collection is created based on the template that was saved, that new site collection will get the document ID site prefix that was stored in the property bag of the original site. This means that both the root web and all sub sites within the new site collection will use the same document ID prefix. The libraries within the new site will also use the list IDs that were stored in the property bag of the original libraries. This means that all documents in all libraries that were created by the template will get duplicate document IDs.

You might wonder why you should care about this, but if your customer made a strategic decision to use the document ID urls in all communication it is very frustrating if a lot of these urls do not properly resolve to a single document, but instead will force the user that clicked on the link to choose between two or more documents that they were potentially looking for.

 

Library on original site 

Library on site created from template

 

The Fix

This issue is fixed in the SharePoint 2010 April 2012 Cumulative Update. Any templates that are created after the CU is installed will work fine and will not generate duplicate document IDs.
If you have installed the April 2012 Cumulative Update your SharePoint version will be 14.0.6120.5000 or for the re-released Cumulative Update it will be 14.0.6120.5006 (thanks Sven!).

Apr 02 2012

I’ll be speaking at the International SharePoint Conference

From April 23rd till April 25th I’ll be in London for the International SharePoint Conference. The conference is organised by Combined Knowledge who were also responsible for the SharePoint Best Practices Conference in London and for the SharePoint Evolutions Conference. This year the conference has a different name again. And it’s not just the name that’s new. Over the course of the three days the development and infrastructure tracks will have solution based sessions. This unique concept is that we will not just be focussing on the different technical SharePoint capabilities, but instead will also be focussing on the process that you will go through when you are working with a client to determine requirements, setup your development environment, build your solution, optimize it, test it and deploy it. And of course while you are working hard to get the client what he wants he might change his mind..

This is how Steve Smith himself describes it:
”Over the last 3 years we have hosted conferences in London that have dealt with new capabilities in SharePoint 2010 in the Evolutions conference and then on to the Best Practices conference last year where we saw our experience with the product emerge with new methods and reasoning behind why not just how you would work with the product. For me however there is always a side that we never truly addressed which is as a developer how do I go from the start of the process all the way through to the end of the process and deploy live to my users.

This is exactly what this conference is going to address for developers. The three days is a continuous journey starting with your requirements gathering and design through to final deployment and test. There are very important steps as well in between such as code life cycle and control plus build - test and deploy stages. How do you create all three of these stages correctly through your development process and how will that effect the way you develop your solution ? We aim to answers these questions and beyond and not just discuss them but take you through the steps throughout the 3 days. Every session will build on the previous session, the speakers will be using the same servers and hardware environment throughout so before the performance test session can even start the build sessions needs to work. This approach to the 3 day solution will benefit both new and experienced developers alike as there will always be something to learn from a true end to end process.”

Read the full posts here: http://www.internationalsharepointconference.com/blog/default.aspx

Besides all this you will also see some very experienced presenters on stage together. Expect a lot of discussion about why certain choices were made, which in turn might help you to make the right decision for your customer.
I am very much looking forward to the International SharePoint Conference and I think it will be a unique experience that you don’t want to miss out on. You can registere here: http://combined-knowledge.com/isc2012/Event_Registration.html

Hopefully we’ll meet between April 23rd and 25th in London!

Mirjam

Feb 29 2012

Coming up: SharePoint Saturday Netherlands

It’s been quiet here again for a while and that is mainly because of all the stuff that is going on in the community.
One of the very cool and pretty things that are coming up is the second SharePoint Saturday Netherlands event that will be held on March 24th in Hotel Vianen. DIWUG and the Office 365 user group have been working together to make this SharePoint Saturday event even better than last year’s event. We will have 16 SharePoint sessions and 4 Office 365 specific sessions. We have sessions targeted at our three key audiences: development, infrastructure and functional and we were able to divide the sessions pretty evenly across those three.

The 300 available tickets are already sold out, but if you haven’t registered yet you can put yourself on the waiting list and we’ll let you know when enough places have freed up.
For those of you who have registered we are really looking forward to meeting you all there, we are sure that it will be another great event!

For more information check out our web site at http://www.sharepointsaturday.org/nl.

SharePointSaturdayBanner

Jan 07 2012

Setting a Default Value for a Managed Metadata Column

Some of the cool new features of SharePoint 2010 are the features related to the Managed Metadata Service Application. A lot of these features were things that companies have been asking for for a while now. For instance the ability to manage hierarchical metadata in a central location, instead of having to create choice lists in every site collection is something that is probably going to be used in the document management solutions of most larger companies. This automatically means that it will be used in a lot of custom solutions as well. At first glance this doesn’t seem like a problem. After all, why would using a managed metadata (site) column in your custom solution be any different then using any other (site) column. To be honest, I’m not sure about the why, although I could think of a few reasons, but using managed metadata columns in a custom solution is vastly different than using any other column.

Personally I had to set a default value of a Managed Metadata Site Column from my custom web part. The step is to add a taxonomy field to my web part, so a user can select a default term. The way to do this is by adding a TaxonomyWebTaggingControl to the web part and setting its properties. We use the current site to setup a session to the Managed Metadata Service Application. Internally the Web Application of the current site is used for this, as Service Applications are linked to Web Applications by Service Application Proxies. Once we’ve got a TaxonomySession we can choose whether we want to get all term stores (TaxonomySession.TermStores), the term store that is selected as the default term store for keywords (TaxomomySession.DefaultKeywordsTermStore), or the default term store for the site collection (TaxonomySession.DefaultSiteCollectionTermStore). Once we’ve got a term store we’ve got to make sure that it’s online and when it is we can request the term group and the term set that we want to use for the site column from it. To assign a term store to a TaxonomyWebTaggingControl we have to assign the term store guid as a string to the SSPList property.

   1: SPSite currentSite = SPContext.Current.Site;
   2: // Instantiates a taxonomy session for the current site
   3: TaxonomySession taxonomySession = new TaxonomySession(currentSite);
   4: TermStore termStore = taxonomySession.DefaultKeywordsTermStore;
   5: if (termStore.IsOnline)
   6: {
   7:     termGroup = termStore.Groups["MyTaxonomyGroup"];
   8:     termSet = termGroup.TermSets["MyTermSet for instance Country"];
   9: }
  10: TaxonomyWebTaggingControl taggingControl = new TaxonomyWebTaggingControl();
  11: taggingControl.SSPList = termStore.Id.ToString();
  12: taggingControl.GroupId = termGroup.Id;
  13: taggingControl.TermSetList = termSet.Id.ToString();
  14: // This controls whether you can add new terms to the term set
  15: taggingControl.AllowFillIn = false;
  16: // This controls whether unresolved terms will just be added to the termset or not
  17: taggingControl.IsAddTerms = false;
  18: // This setting allows you to browse the term set
  19: taggingControl.IsDisplayPickerButton = true;
  20: // This setting enables/disables validation highlighting
  21: taggingControl.IsIgnoreFormatting = false;
  22: taggingControl.IsIncludeDeprecated = false;
  23: taggingControl.IsIncludeUnavailable = false;
  24: // This setting modifies what is stored/returned from the control
  25: // if you want the GUIDS of parent terms then set this to true
  26: taggingControl.IsIncludePathData = true;
  27: // This setting will include term set name resolution as well if set
  28: taggingControl.IsIncludeTermSetName = false;
  29: taggingControl.ID = "MyCustomMetadataControl";
  30:  


Now a user can select a default value. By after a user clicks a button we can store the value the user selected as the default value of the site column. Be aware that if you let non-Site Owner users select a default value that you will have to use impersonation as only Site Owners can set default values for site columns.

The way we have to save a default value for a taxomony column is very specific. You can leave some of these steps out and it will seem like it works. If you go into the Site Column management user interface via the Site Settings page in your site you will probably see that a default value has been selected and it will seem like SharePoint resolves the value without a problem. However if you are using the column in a document library and you are trying to create a new document in Word 2010 the document information panel will indicate that the default value is a value that doesn’t exist in the term store. Pretty tricky that!

The value of a Managed Metadata Column is build op from three parts:

  • The Id of the term as it is stored in the TaxonomyHiddenList . The TaxonomyHiddenList caches all terms from the term store in the site collection. The link is referred to as the WssId.
  • The label of the term
  • The guid of the term

The format of the value looks like this:
<WssId>;#<TermLabel>|<TermGuid>

In order to set a value for a TaxonomyField we have to use a TaxnomomyFieldValue.
We can use the PopulateFromLabelGuidPair method to convert the Text value of the TaxonomyWebTaggingControl on our web part into a valid Label/Guid pair.
We are setting the WssId to –1. We could try to retrieve the actual Id of the term from the TaxonomyHiddenList by using the TaxonomyField.GetWssIdsOfTerm method, but if we set it to –1 SharePoint will resolve it for us and will even add the term to the TaxonomyHiddenList if it’s not already in there.
Another oddifity is that we have to convert the guid of the selected term to a lower case guid, or the Document Information Panel in Office 2010 won’t recognize the term.

1: TaxonomyField taxonomyField = SPContext.Current.Site.RootWeb.Fields.
GetFieldByInternalName(["MyManagedMetadataSiteColumn"]) as TaxonomyField;

   2: TaxonomyFieldValue defaultValue = new TaxonomyFieldValue(taxonomyField);
   3: try
   4: {
   5:     defaultValue.PopulateFromLabelGuidPair(taggingControl.Text);
   6:     defaultValue.WssId = -1;
   7:     // GUID should be stored lowercase, otherwise it will not work in Office 2010
   8:     defaultValue.TermGuid = defaultValue.TermGuid.ToLower();
   9:     // Set the selected default value for the site column
  10:     taxonomyField.DefaultValue = defaultValue.ValidatedString;
  11:  
  12: }
  13: catch
  14: {
  15:     ErrorMessage.Text = "Creating a new term is not allowed, please select an existing term.";
  16:     taxonomyField.DefaultValue = String.Empty;
  17: }
  18:  
  19: taxonomyField.UserCreated = false;
  20: taxonomyField.Update(true);


I think I would still be looking for a solution for this if it wasn’t for Donald Hessing’s answer on the SharePoint Forums, so thanks Donald!

I hope this post will save others some time, just like Donald’s post saved me some time.
Oct 29 2011

Finding the application pool account for a web application

I get a lot of questions from people who read my post on Configuring claims and forms based authentication for use with a SQL provider in SharePoint 2010 about how to find the application pool account for a certain web application.

  • The first thing you have to do is to find out what application pool is being used for you web application. In order to find this out we need to open up IIS (Internet Information Services) Manager. Click on “Start” – “Administrative Tools” – “Internet Information Services (IIS) Manager”.

OpenIIS

  • Open up the drop down on the left and look for your web application in the “Sites” list.
  • Select the web application you want to find the application pool account for and click “Basic Settings’ in the panel on the right.

BasicSettings

BasicSettings2

In my case the application pool for my web application is “SharePoint – Web Apps”.

  • Now we have to find the application pool account and we have two ways in which we can do this.
  • We can find the application pool account in IIS by selecting “Application Pools” in the left panel. This will show the list of application pools in the middle.
  • Find the application pool that you found in the basic settings of your web application. Right of the name of the application pool the application pool account is displayed. If you are looking for the application pool account of your Central Administration web application you can simply look to the right of the “SharePoint Central Administration v4” application pool. In my case the application pool account of my Central Administration web application is “SOLUTIONS\spfarm”.

ApplicationPools

  • If you know the application pool of your web application you can also find the application pool account from the SharePoint user interface.
  • In order to do this open up Central Administration and click on “Security”.
  • Now click on “Configure service accounts”.

CASecurity

  • In the drop down select the application pool of your web application. This will display the application pool account in the text box.

ConfigureServiceAccounts

  • If you are looking for the application pool account of your Central Administration web application you have to select “Farm Account” in the drop down box. The farm account is also the application pool account of your Central Administration web application and selecting farm account in the drop down will make the account show up in the text box.

That’s all there is to it!