Wednesday, July 8, 2015

SharePoint 2013 .... oh you naughty Managed Metadata Service.

The Managed Metadata Service or Connection is currently not available


So there everyone was using the termstore to happily tag document and list data with great ease using the Managed Metadata Service, when all of a sudden....





WTF!  Oh, breathe, this is SharePoint, these kind of issues are part of the package...let look at the ULS (log).

07-08-2015 14:50:54.86 w3wp.exe (0x2160) 0x2FA4 SharePoint Server Taxonomy f8bn Monitorable Failed to get term store for proxy 'Managed Metadata Service'. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.     at Microsoft.SharePoint.Taxonomy.Internal.XmlDataReader.GetDateTime(String name)     at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore.Initialize(IDataReader dataReader, Guid termStoreIdValue, Boolean fromPersistedData)     at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore..ctor(IDataReader dataReader, Guid termStoreId, Boolean fromPersistedData)     at Microsoft.SharePoint.Taxonomy.Internal.DataAccessManager.GetTermStoreData(MetadataWebServiceApplicationProxy sharedServiceProxy, Boolean& partitionCreated) 4efe179d-3828-e053-26eb-92b558cf8026

Okay, a "keyNotFoundException", seems serious?  Without boring myself, this is how you fix it, with hardly any stress to you :-)  Open SharePoint CentralAdmin, so to Service Applications, select your Managed Metadata Service (if you called it that) and click properties in ribbon, like so...


You will get a popup like this.




Then make sure you backup (just in case) the metadata database, before doing the next steps.

In the DATABASENAME, prefix it with something like "TEMP", then click OK, this might create a DB with this name (you can delete it later).



Check the Managed Metadata Service, it should be working.  But with a new DB...Noooo!  Dont stress.  Repeat the above step, but this time, remove the prefix we added "TEMP" and click OK.

Voila, if all is well, your Metadata will be back up and running, with all its termsets.


In summary:


  1. Rename database for existing Managed Metadata Service.
  2. Click OK
  3. Check Metadata Service working (with new database)
  4. Rename database back to original
  5. Click OK
  6. All should be working.

Why this is caused, I dont know, will it happen again, likely.  If I figure out what the cause is, I will update this post, else, life goes on.









Monday, July 29, 2013

SharePoint 2010 - Hidden Querystring options

Some commands to change the mode of a page your are on.


Add Web Parts \ Search ToolPaneView=3
Add Web Parts \ Browse ToolPaneView=2

View Mode mode=view
Edit Mode mode=edit

Personal Mode PageView=Personal
Shared Mode PageView=Shared



example newForm.aspx?ToolPaneView=2&PageView=Personal


AllItems.aspx?contents=1 will open Web Part Page Maintenance: AllItems




Friday, May 3, 2013

SharePoint 2010 Server rename - Cannot connect to configuration database error

Assumptions (not best practice): You have a standalone SharePoint 2010 farm installation.

Problem: Oh dear, you ran the stsadm renameserver command after you renamed the actual server name.  Now you getting the dreaded Cannot connect to the configuration database error.

Never fear, there is a solution to this and its relatively easy, its worked for me.

1. Create an alias from oldservername, to newservername in mssql configuration manager.  If you are using named instances for your SharePoint farm databases, setting up an alias for a named instance can be a bit tricky, but here is how its done http://bigjimindc.blogspot.com/2009/08/ms-sql-server-named-instances-and.html

2. Once the alias is done and is working, you will now be able to access the central administration.  Once in, go an update the alternate access mappings in central administration , then simply run the stsadm renameserver command again.  


stsadm -o renameserver -oldservername "oldserver" -newservername "newserver"

3. Now, remove the aliases (delete them)

4. Reboot server (if you can, else restart mssql and iis).

5. You should now have a working SharePoint farm again.


I believe you HAVE to run the stsadm renameserver command before you rename a actual servers name.  But sometimes you cannot do this and therefore my steps above should help you fix a "broken" SharePoint farm.  Well it did at least for me :-)


Thursday, April 25, 2013

SharePoint Designer 2013 - SharePoint 2013 Workflow

Enabling SharePoint 2013 Workflow in SharePoint Designer 2013.

By Default, SharePoint 2013 Workflow is not available in SharePoint Designer 2013, you need to install workflow manager first, then configure it.



Steps to follow:


  1. Install Workflow Manager Client http://go.microsoft.com/fwlink/p/?LinkID=268376
  2. After installation, if you are communicating with Workflow manager via http or https you may need to change the powershell cmdlet to suite.  In my case I was using it over HTTP, so the following cmdlet worked for me.  You can have a look for "Workflow Management Site" in IIS, to get the workflowhosturi.
Register-SPWorkflowService –SPSite "http://myserver/mysitecollection" –WorkflowHostUri "http://myserver:12291" –AllowOAuthHttp

After those steps, you should now have the SharePoint 2013 Workflow enabled.

To see more detail, have a look at this technet article. http://technet.microsoft.com/en-us/library/jj658588.aspx#section4

Wednesday, April 3, 2013

Get fields using Javascript Client Object Model


Using the Javascript Client Object Model, you can get values from a listitem. 

How to use the JSOM is described here Code Project

Title – SP.ListItem.get_item(‘Title‘);

ID – SP.ListItem.get_id();

Url -SP.ListItem.get_item(‘urlfieldname‘).get_url()

Description – SP.ListItem.get_item(‘descriptionfieldname‘).get_description();

Current Version – SP.ListItem.get_item(“_UIVersionString“);

Lookup field – SP.ListItem.get_item(‘LookupFieldName’).get_lookupValue(); // or get_lookupID();

Created By – SP.ListItem.get_item(“Author“).get_lookupValue();

Modified by – SP.ListItem.get_item(“Editor“).get_lookupValue();

Choice Field – SP.ListItem.get_item(‘ChoiceFieldName‘);

Created Date – SP.ListItem.get_item(“Created“);

Modified Date – SP.ListItem.get_item(“Modified“); -> case sensitive does not work with ‘modified’

File  – SP.ListItem.get_file();

File Versions -  File.get_versions();.

Content Type – SP.ListItem.get_contentType();

Parent List – SP.ListItem.get_parentList();

Note:  (‘LookupFieldName’).get_lookupValue() sometimes returns an array of data, especially when your lookup allows multiple values.
In that case you will need to iterate the array and get each value individually.

 SP.ListItem.get_item(‘LookupFieldName’)[0].get_lookupValue(); - this will get the first item in the array.

For Arrays:


       for(var i = 0; i < oListItem.get_item("LookupFieldName").length; i++)
{
     alert(oListItem.get_item("LookupFieldName")[i].get_lookupId()); // or get_lookupValue()






Friday, February 8, 2013

Calculated Column - Add x days to created date, excluding weekends.


Overview

Say a user creates a item in a list and they have 3 (working days) to to mark it as completed, how do we do this?

1. Create a new field in the list (calculated field of type date and time), lets call it "escalate date", then using this formula.

=IF(Weekday([Modified])>3, [Modified]+5, IF(Weekday([Modified])>1,[Modified]+3, [Modified]+4))

2. Create a workflow that starts on item created and changed, that pauses until the "escalate date", once that date is reached, workflow checks if item was marked as completed or not.


Explanation of Weekday.

Using Weekday, we can determine which day of the week the share point list item was created and add 3 working days to a calculated column.


WeekdayReturnsDays to addEscalate Date
Sunday1+4Thursday
Monday2+3Thursday
Tuesday3+3Friday
Wednesday4+5Monday
Thursday5+5Tuesday
Friday6+5Wednesday
Saturday7+5Thursday

Friday, July 27, 2012

SP2010 - Dynamic List filtering - without code, using just the URL

You have a list and you want to filter the list using a URL.

Normally you would do it like this:

http://myurl/sitename/listname/Forms/AllItems.aspx?FilterField1=Country&FilterValue1=America

This is great and you can extend it to include other columns by using FilterField2,FilterValue2,FilterField3,FilterValue3    and so on.

But what if you want to filter the same column with more than one value, using FilterField options will only allow one filter per column.  So in comes "FilterName and FilterMultiValue"

To use, its simple

http://myurl/sitename/listname/Forms/AllItems.aspx?FilterName=Country&FilterMultiValue=America;South Africa

BAM! you now have a filter on the same field, its an OR filter, but its still great :)