Introduction/ Question / Hypothesis
So earlier today Marc D. Anderson [http://www.sympmarc.com or @sympmarc] sent out a tweet regarding a SharePoint Designer Workflow not firing and pointed us to a post he added in StackExchange here SharePoint Designer Workflow Not Always Firing so I wont belabor this post with the details, he spells it out quite excellently.
So, a few of us Scott @ciphertxt Hoag, myself, Tasha @tashasev Scott chimed in and offered approaches to solving the problem, notwithstanding the great suggestions, and they were great suggestions, my bias as a SharePoint developer [ignoring that you should seek Out of Box solutions first] commented ad-nausium that it could be handled quite easily with an event receiver, assuming that you were allowed to write code as a solution to the issues faced.
Schooled as I am from the British educational system in the commonwealth, I approach everything through a scientific method. So, my approach was going to be
- Create an Environment adhering to the same boundaries as the test case
- Create an Empty SharePoint Solution in Visual Studio 2010
Create two Projects
- Project 1: A Console App to Prove out the work
- Project 2: The actual event receiver with the (hopefully) working code
- Test, Re-Test, Brag about it J if it works
Creating the Environment
First thing to do was create an environment for the Managed Metadata Service with my own nomenclature but adhering to the test case
Next we create a list to consume the information
Configure the MMS Column to get data from the Term Set under the MarcDAnderson Group
Creating the Visual Studio Solution
Next we have to create a blank SharePoint Solution in Visual Studio. I do this because I don’t want any of the extraneous things that come with a predefined project as well as, I plan to have a tester project as well as an Event Receiver Project, its easier and cleaner to control that yourself.
You will notice the Tester Project is set as Startup, we will change that for the Event Receiver time to deploy. So, since we will be working with Managed Metadata Service (MMS) you will need reference not only to the standard SharePoint dlls, but also Microsoft.SharePoint.Taxonomy as well, in both your Console App and the actual Event Receiver.
As this was an empty project, when you click on the project and do "New Item" and select Event Receiver, it will add the Microsoft.SharePoint and Microsoft.SharePoint.Security, but you will have to manually add the .Taxonomy
When you have done that, its time to code out the Tester Console App, which is quite simple, and after I was done I realized I could have just gone straight to the Event Receiver because it wasn’t that complicated, in fact, its more lines of code in the tester than there will be in the production deliverable.
Testing out that code yielded the below.
Next I coded out the Event Receiver, since the context of the Item is inside the SPItemEventProperties, no need for a SPSite, SPWeb ect. I just needed an SPListItem object to bind to the Event Properties as in Line 21 and we are off to town. MMS Fields are in value pairs, Label and Guid, so you use the TaxonomyFieldValueCollection to bind to the field holding the MMS value and then split it base on the Pipe [|] character that separates the named values. As you can see on line 27 I have the pair commented out, that is because Marc only needs the Label, as shown in line 28. After that its just setting the Text Columns named "ValueStringFromCategory" with the values from the MMS Field and calling the Update Method.
That’s it, now time to Deploy and Test..
Once deployed, you can just add a new item as you see below
Select the MMS field or fields, I did set mine to multi-value, it wasn’t called out in the Test Case, but I wanted to be complete.
Click OK, leaving out the third field because that WILL be filled out by the Event Receiver. Click Save when done.
You will notice that the field is blank when you click save, but when you refresh the list, as seen below, the item appears. If you did this in the ItemAdding Event of the Event receiver then you would not need to refresh. But i didnt, so…
So, lessons learned. Marc says that this is ok, but doing a Custom Workflow activity would take this to the next level, so will tackle that on the plane ride to #SPS12
Cheers all.. See you in VEGAS!!
Part 2 of 2: Focusing on Content Organizer, Routing Rules, Content Types and Search
Synopsis: Building on my previous post Understanding Managed Metadata in SharePoint 2010: its Impact on Taxonomy, Navigation and Search we discussed how Managed Metadata may be used to build out a Sites Taxonomy and Folksonomy, aid in Navigation and compliment or extend Search. In this post we will discuss the role of the Content Organizer, Routing Rules, and how Managed Metadata may be used in Content Types to dictate where a content final resting place may be.
In order to use Content Organizer it has to be Activated as a “Site Feature”; notice below in the Quick Launch that under ‘Libraries’ there is only one Document Library before the Feature is activated, “Documents”, however once activated in the second image, there is a new Document Library called “Drop Off Library”. The purpose of this library will be discussed further in this blog, for now lets just go step by step in creating and using it.
Above: Content Organizer is a Site Feature so you have to activate it at a site level. Remember that when you think about scope and routing
Above: Once Activated you get the link above
In addition to the activate icon practically what you have are new items under the Site Administration menu in Site Settings. Before you activated “Content Organizer” you did not have options for (1) Content Organizer Settings or (2) Content Organizer Rules. In addition you also get a Document Library called “Drop Off Library” which is where all documents go that do not adhere to a defined rule.
Above: Site Administration with Content Organizer Not Activated
Above: Site Administration with Content Organizer Activated
In Content Organizer Settings you have a few options as presented below. There are a few options here worth mentioning. Most notably is the option for Folder Partitioning; in previous versions of SharePoint folder use was de-emphasized because of the inability to tie meta-data to folders and the manageability aspects of maintaining and making visible what is inside a folder with little effort. Folder partitioning solves that by allowing you to create rules around how big a folder gets before you break it into two, or three, or four…
Above: Content Organizer Settings
In this example what I will do is build upon a pervious post where we discussed the use of Managed Metadata Understanding Managed Metadata in SharePoint 2010: its Impact on Taxonomy, Navigation and Search and we will use the Content Organizer to effectively route documents to an appropriate destination. In this example we will say that we have:
- A Content Type based on our Managed Metadata
- Use the Content Type to build a Content Organizer Rule
- Route documents based on Content Type to the appropriate folder
Above: This is our Managed Metadata in our Term Store, we will focus on Exchange and SharePoint items/ work products
First we create a new Document Library called Projects and we will have Folders in there that are broken up based on Technology.
Above: Document Library called Projects is created
Above: Folders for Exchange and SharePoint is created
Next we will create a rule for both Exchange and SharePoint as denoted below; we will also use the Managed Metadata as a means by which to route information see below…
Above: A Content Organizer Rule that send artifacts to the Exchange Folder based on the Managed Metadata of Exchange 2007 or Exchange 2010 selected.
Above: A Content Organizer Rule that send artifacts to the SharePoint Folder based on the Managed Metadata of SharePoint 2003 or SharePoint 2007 selected.
Below you see the result of our rules as they are defined and notice I also made one a higher priority over the other.
Above: Content Organizer Rules are defined
Next I will demonstrate two examples
- Uploading a document and applying the Managed Metadata as the document is persisted to the library
- Create a new document and use the DIP to apply the Managed Metadata to the new document
Above: Uploading a document to the Library Root; no folder specified
Above: By clicking on the Tag Icon I can select or Multi-Select the appropriate fields
Above: Fields Selected
Next, we will create a new document from that library based on that Content Type (to which the Managed Metadata played a role), note in the DIP that we can select our options.
Above: New Document created in the Document Library and the DIP is used to apply the relevant tagging
Above: Post Selection and apply a name to the new file
Above: Name applied to the new file and persisted to the SharePoint System
Note here that based on the fact that I selected a Managed Metadata that is flagged in a rule, the Document is persisted however it is saved to an alternate location based on the rules in the Content Organizer. Again, the WIN here is how you can create a Taxonomy and/or Folksonomy that can not only drive Structure, Navigation, Search, but can also provide intelligence in-terms of location.
Above: The Final Destination is not where the intent of the end user is, rather, it is based on rules.
An examination of the folder [by clicking on the link or using the quick launch bar] shows that the document is routed by a rule.
Above: Final resting place for this Status Report is in the Exchange Folder because of the hit on the Managed Metadata during content creation / uploading.
Above: Using the Managed Metadata Navigation feature in SharePoint you can also navigate, filter, based on the now MILLIONS UPON MILLIONS of rows that can be placed in a list.
the takeaway here is that Content Organizer is huge, and it builds upon other feature sets in SharePoint 2010 to make the overall experience very clean, simple, and results driven. Come see my session at SPS Ozarks to learn more.
Comments and Critiques are welcomed. Spread the word.
June 2, 2010 Posted by fabiangwilliams | Content Organizer, Folksonomy, Managed Metadata, SharePoint 2010, SharePoint 2010 RTM, SharePoint Administration, SharePoint How-To, Taxonomy, Term Store | 1 Comment
Part 1 of 2 – Focusing on Managed Metadata, Term Store, Navigation and Search
Acknowledgement: First I would like to thank Wictor Wilén (MVP / Author / MCT / MCTS / MCP / MSc) out of Sweden who’s article Create SharePoint 2010 Managed Metadata with Excel 2010 was instrumental in speeding up the process of creating my Managed Metadata Term Store for both a live project and this blog. I would also like to thank Chris O’Brien (MVP) out of the UK, who’s article Managed Metadata in SharePoint 2010 – a key ECM enhancement really puts the value of Managed Metadata in perspective. The articles mentioned above is the foundation by which I build out a Lab which culminates Wictor and Chris’s work into a Business Case resulting in better Management of Site Columns, Content Types, Content Organizer Routing Rules, Taxonomy/Folksonomy Navigation and enhancements in Search.
Wictor may be found on Twitter here @Wictor and Chris’s Twitter handle is @ChrisO_Brien I follow them, I recommend you do the same if you are a Dev in SharePoint.
So, if you are a regular reader of my blogs, you already know that I try my very best to put some kind of Use/Business case or a story around the technology I am trying to showcase. This time my only difficulty was to take what I am actually doing in SharePoint 2010 Proof of Concept and replicate it in my Lab so it obscures the real work and the identity of the client. Not too hard right, just a lot of duplication of effort, but you know what they say about practice…
What we have here is a company called “Fabian Williams Enterprises” and it has offices in Jamaica and the United States, as an organization that supports its employees and earn a profit, it has the following departments:
These departments have documents that meet the following criteria:
- May or may not be restricted to the the country of origin (HR Documents, Contracts, etc)
- Project Specific Data (Civilian, Government, Technology Specific)
As a company trying to be agile in this competitive marketplace, it strives to
- Leverage Corporate Memory to surface meaningful information for its employees
- Create a hierarchical structure for the organization and dissemination of information
- Increase Search responses and improve Search Relevance
- Allow its employees to Organically Grow the Enterprise Knowledge sharing capabilities of the company through Social and Collaborative means
What we are working with
Our Employees, SharePoint…
Above: AD OU with the Users in the company. Thanks to some of my colleagues who are always my guinea pigs here..
Above: User Profile configured and Imported
Above: The Actors
Step 1 – Configuring the Managed Metadata Service Application
So you maybe wondering why I showed you the items above; yeah, I like the nice pictures and silverlight addin but the real takeaway here is that Out of Box (OOB), The Managed Metadata Service already took information from your Active Directory and build keywords that in the end would reference the individuals above; all this without asking you one thing. Pretty cool huh.. look see…
Above: Central Administration Managed Metadata Page
Next I will begin the process of Adding myself and the Service Account I am logged in under (SPInstall) as Administrators with the requisite permission to manage this Service Application. By going to Central Admin, Application Management, Manage Service Application, Managed Metadata Service, clicking not on the word but on the bar next to the phrase, you can click in the ribbon a few options, first, Administrator
Above: The Administrator Dialog
Above: Permissions Dialog
Once you have done that, now you can create a new Group and then Term Stores within.
Above: Clicking on Managed Metadata Service will yield a dropdown where you can create a new Group, I will do that later but for now…
Wictor Wilen created a fantastic Macro that allows you to create a Term Store File or a Term Store Sheet
Above: the Ribbon Macros
In my example I created my organization layout as you would if you were going to a client and discussing Taxonomy. This is of course not something I would take to production but it give in one glace how you may layer Terms, Inherited Terms, etc, which will be consumed in Site Columns, aid Content Types, and so on and so on.. I made an error here below which i found out only after uploading it. It is not critical it is purely syntax but the result will do this (1) not permit me to use the SharePoint 2010 term and the other (2) is nothing inherits from Region
Above: Wictor Wilens’ Excel work on creating Managed Metadata Term Store get it here… Create SharePoint 2010 Managed Metadata with Excel 2010 once you are finished, by clicking “Create Term Store File” in the ribbon you get the text file (csv) which may be imported directly into the Managed Metadata Service Application.
Above: Resultant CSV File
Above: Now that we have a text file for our Managed Metadata, we
- Create a new Group “FabiansWorld”
- Import Term Set
Above: once you click Import you will navigate to the location of your csv file and Pull it in.
As a result you see below, your hierarchy created in the CSV file is represented below at the levels you determined in the spreadsheet.
Above: the newly imported Term Store and Tags
Below is an important point, that can be the unsung hero in ensuring that a company that:
- is Multinational so its words have cultural differences
- has ever changing terms or terms that are often deprecated
- has its own lexicon which is not the same has industry or your partners
you can create Synonyms for those terms in the example below we have “SharePoint 2007” which also is “MOSS”. You simply just type in the labels and be on your way, this may not be the most efficient way to do this, so i suggest the API as you cant do it with the csv file. well not that i know of. Wictor?
Above: a synonym for the term “SharePoint” pointing to “MOSS”
Next, I wanted to show some of the configurables here, some that are particularly important are
- Submission Policy [default is Closed], but I selected “Open”, this allows for the end users to build on this Taxonomy that is defined in the company; a term called Folksonomy . I strongly advocate this approach but it has to be managed otherwise you can get duplicates, bad terms, inappropriate terms LOL, etc, you know what i mean. As a coder, I would not shy away from this but I would put it under a list and use an event receiver after an approval workflow to persist it to the Taxonomy.
Above: Taxonomy and Folksonomy hand in hand.
Next I will create a few files and and upload them to my Document Center that I created.
Above: Various Files and File Types that can also be Content Types based on your Taxonomy.
Next I will NOT use my Managed Metadata as a Column in my Document Library, I will use OOB “Enterprise Metadata and Keywords Setting” which will allow me to use Tags from that Term Set but does not give me the ability to navigate and get to my terms. This shows that you can just use your Taxonomy and Folksonomy in OOB Library Settings
Above: Document Library in my Document Center with Enterprise Keywords added
Above: I added a document called “Code of Conduct” and I begin to type ‘Comm…” and all of a sudden i get Write Aheads with my terms pretty cool huh…
However (and I am not naming names here but he is my work colleague LMAO) had a blog where he did not see his Managed Metadata Terms when he went to the Navigations Settings for Metadata. That is by design, you MUST add a Metadata Column to your Library, and based on the level in the hierarchy that you choose you will get that top level and any child level in this pane below. If you dont do that, you will see what is evident below.
Above: Using “Metadata Navigation Settings” without adding a “Managed Metadata Column” will yield the above.
However if you create a column of type “Managed Metadata” and pick a level within your store…
Above: Column Name “FabianWorldTax_Folks_onomy” of type “Managed Metadata” is added to the library
Above: all the settings i choose. I deliberately choose (1) Required Field (2) Allow Multivalue
After you select “Ok”, now you have a column linked to your Taxonomy/Folksonomy in your Document Library / List
Above: the newly created column.
Now you are able to consume your Taxonomy and Folksonomy (if you permitted this) in the Navigation Settings and Filter Settings.
Above: Navigation Hierarchies and Filters may be used in this library now based on the Managed Metadata you crated.
The value here is NOT with the one or two document that I have in there now, but when you have Millions upon Millions of documents in this Library which may also be broken up in Partitioning Folders; here is away to filter or trim the noise from the data. Here is the money shot.
Above: Same process as before in the OOB example but this time I can click on the ‘Tag’ Link and get to seem my tree where i can now select meaningful information whereas i may not have known before.
Above: Click Save and you are on your way.
What you will notice below is that there are two documents and the Navigation tree is on the top level.
Above: Two docs showing at top level of Metadata Navigation
But what happens if I select “International” from the Navigation Tree…
Above: The result set is peered down [with NO POSTBACK mind you] to the result set i further defined.
How Search is also Impacted
The value here is that in the previous example you “hunted and pecked” to get what you wanted. Here I am going to do a search on
- a Key Term in my Metadata or maybe i know that ‘Communications’ is in the document or tag for what i want.
- I filter on a Taxonomy / Folksonomy term based on my search results to get a more granular result set.
Before i do that however, I need to do a crawl, see below…
Above: Crawling the Local SharePoint Sites
Here I am doing a search on the word ‘Communications’
Above: The result set comes back with two items. Both were tagged as a HR Communications Document based on my Managed Metadata
Next i do a search on ‘International’, here you go again…
Above: Another search with Hit Highlighting
Finally, I click the Navigation Aid in my Search Result set for International, Imagine if you had 10 pages of results, now you can peer it down as I did.
Above: Filter applied to my Search Result Set.
How can you not love this. So there are two value adds here
- Navigation is enhanced by the Managed Metadata
- Search is Refined by the Managed Metadata
Hope this was helpful, critique & comments welcomed…
Part 2 of 2 will focus on Managed Metadata and how it can be used to enrich “Content Organization” in SharePoint 2010
May 30, 2010 Posted by fabiangwilliams | Folksonomy, Managed Metadata, SharePoint 2010, SharePoint 2010 RTM, SharePoint Administration, SharePoint How-To, Social SharePoint, Taxonomy, Term Store | 8 Comments
- 429,315 hits
- Azure (6)
- Business Connectivity Services (20)
- Client Side Coding (1)
- Content Organizer (1)
- Content Types (2)
- Entity Framework (2)
- Facebook (1)
- Folksonomy (2)
- IIS (2)
- JSON (11)
- Kerberos (2)
- LAMP (1)
- Linux (1)
- Managed Metadata (3)
- Metalogix (1)
- Mobile (1)
- MobileApps (1)
- MVC (1)
- MySites (1)
- OData (2)
- Office 2010 (5)
- Office 2010 Beta (10)
- Office 2010 TP (4)
- Office 365 (9)
- Office Social Connector (1)
- Outlook 2010 (2)
- PhoneGap (1)
- PowerShell (1)
- Public Speaking (9)
- REST (13)
- Secure Store (2)
- Sencha (1)
- SharePoint 2010 (45)
- SharePoint 2010 RTM (9)
- SharePoint 2013 (19)
- SharePoint 2013 Workflows (8)
- SharePoint Administration (35)
- SharePoint Bug (4)
- SharePoint Designer 2010 (6)
- SharePoint Designer 2013 (15)
- SharePoint Development (31)
- SharePoint Error/Resolution (12)
- SharePoint Errors (1)
- SharePoint Friends (1)
- SharePoint General (24)
- SharePoint How-To (61)
- SharePoint Migration (2)
- SharePoint Online (5)
- SharePoint Saturdays (9)
- SharePoint Workspace 2010 (1)
- Site Columns (2)
- Social SharePoint (2)
- SQL Server (9)
- Strange Stuff (7)
- Tags and Ratings (2)
- Talking Technology (1)
- Taxonomy (2)
- Term Store (2)
- Ubuntu (1)
- Uncategorized (6)
- Video Screencast (2)
- Visual Studio 2010 (9)
- Visual Studio 2012 (5)
- Visual Studio 2013 (3)
- WCF (3)
- Webcast (3)
- Where is Fabian (26)
- Windows Administration (2)
- Windows Azure (2)
- Workflows (6)
Search my Blog
- December 2013 (3)
- November 2013 (3)
- October 2013 (5)
- September 2013 (9)
- July 2013 (2)
- May 2013 (3)
- April 2013 (6)
- December 2012 (1)
- November 2012 (1)
- April 2012 (1)
- February 2011 (1)
- November 2010 (1)
- October 2010 (3)
- September 2010 (4)
- August 2010 (2)
- July 2010 (3)
- June 2010 (3)
- May 2010 (1)
- April 2010 (7)
- March 2010 (5)
- February 2010 (7)
- January 2010 (3)
- December 2009 (7)
- November 2009 (16)
- September 2009 (6)
- August 2009 (6)
- July 2009 (8)
- June 2009 (1)
- May 2009 (1)
- April 2009 (7)
Pick your Poison!Activity Feed Azure BCS BDC BPR Business Connectivity Service Business Connectivity Services Business Process Content Source Cumulative Updates Document Library Enterprise Search Event ID: 3351 Event ID: 6398 Event ID: 6872 Fabian Fabian Williams Full-Trust Proxy Happy Birthday Fabian IA JSON LINQ LINQ to SharePoint London Loops Managed Metadata Metalogix MOSS 2007 MOSS 2010 MSDN; Workflows; SharePoint; Visual Studio MVC MySite Object Model Office 2010 Public Speaking; Smposium REST Sandbox Solutions Search Scope Secure Store Shared Service Provider SharePoint SharePoint 2010 SharePoint 2013 SharePoint Designer SharePoint Designer;Workflow SharePointFabian SharePoint Workspace Social SP2010 SPD SPEVO13 SPLive360 SPTechCon SSP Stages Taxonomy UserProfile Visual Studio Workflow Workflows Workflows; SharePoint; Visual Studio
- @iOnline247 @phillipharding @jthake #letmegooglethisforyou :-) github.com/PowerShell/Pow…...next... 17 hours ago
- Headed out of town today to Richmond for meetings tomorrow, & #DemosGotMeLike :-) gph.is/1oXJHnO...next... 2 days ago
- Why Enterprises are Moving to @Xamarin for #Mobile #AppDevelopment blogs.msdn.microsoft.com/premier_develo…...next... 2 days ago
- Apple announces Clips app that combines video, photos, music w/ animated captions & effects flip.it/a_Lt0-...next... 2 days ago
- Yeah! After visiting last & this year, not at all surprised that #Norge #Norway took the top spot! @mikaelsvenson cnbc.com/amp/2017/03/20…...next... 4 days ago
- The future is algorithms, not code flip.it/IsYkql...next... 4 days ago
- @iOnline247 Amy day over 65 man!...next... 5 days ago
Request Me to Speak!
Download Blog Mobile App
Where U At? – Places I beEvent NameDate(s)Role
SharePoint Conference 2014 - Las Vegas 03/03/2014 - 03/06/2014 Speaker SharePoint Saturday - DC-Reston 12/07/2013 SpeakerPrevious EngagementsTimeframeRole SharePoint Live - Orlando 11/18/2013 - 11/22/2013 Speaker Dev Connections - Las Vegas 9/30/2013 - 10/4/2013 Speaker SharePoint Saturday Columbus 09/14/2013 Speaker SharePoint Saturday New York City 07/27/2013 Speaker Microsoft TechEd North America 06/03/2013 - 06/06/2013 MS Staff SharePoint Evolutions Conf. - London 04/15/2013-04/18/2013 Speaker SharePoint Saturday - Indianapolis 01/12/2013 Speaker SharePoint Satureday- Virgina Beach 01/05/2013 Speaker CY 2011 & 2012 Various Events On My Old SP2010 Blog Speaker SharePoint Saturday - Ozarks 06/12/2010 Speaker SharePoint Saturday - New York 06/31/2010 Speaker SharePoint Tech Conference - Boston 10/20/2010 Speaker SharePoint Saturday - D.C. 05/15/2010 Speaker SharePoint Saturday - New Orleans 02/27/2010 Speaker SharePoint Saturday Online - Arabia 03/27/2010 Speaker SharePoint Saturday - Charlotte N.C. 04/10/2010 Speaker SharePoint Saturday - Indianapolis 01/30/2010 Speaker SharePoint Tech Conference - San Fran 02/10/2010 - 2/12/2010 Speaker SharePoint Saturday - Virginia Beach 01/9/2010 Speaker SharePoint Saturday - D.C December 2009 Speaker Baltimore SUG November 2009 Speaker SharePoint Saturday - San Antonio November 2009 Speaker SharePoint Conference 2009- Vegas October 2009 Attendee SharePoint Tech Conf - Boston June 2009 Speaker SharePoint Saturday - Baltimore June 2009 Panelist SharePoint Tech Conf - San Fran January 2009 Speaker
- How To: Create, Configure, Consume SharePoint 2010 Secure Store in Business Connectivity Services
- Using the Call HTTP Web Service REST Calls in SharePoint Online using SPD
- More on SharePoint 2013 REST API with Fiddler and SPD
- Creating a SharePoint Timer Job using SharePoint Designer 2013
- Understanding Managed Metadata in SharePoint 2010: its Impact on Taxonomy, Navigation and Search
Site infoFabian Williams SharePoint Blog
Blog at WordPress.com.