Find the Id of a Ribbon button in SharePoint

When you are trying to customize the SharePoint Ribbon you might want to hide a few of the buttons. There are a few ways to do that, including obviously css manipulation. The recommended way is to deploy a custom action element with the following details.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.XXX.YYY.ZZZ" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>

The text XXX.YYY.ZZZ symbolizes the name of the button on the ribbon. Most of the buttons have standard names, and can be guest, like the button for creating a new folder in a documents library – “Ribbon.Documents.New.NewFolder”. There are some buttons though, that are a bit different.

A good example is the button for editing with Infopath – “Ribbon.List.CustomizeList.Controls.btnCustomizeList2”. When looking for button names like this you may end up looking up the CMDUI.XML that is located in the SharePoint hive folder on the path: TEMPLATE\GLOBAL\XML. You can find a lot of the button names there, but unfortunately not all.

The solution to this problem is to look up the button id on the page. The id that we are looking for will be used there for the id of the link tag.

You could look up the button id in a few different ways, but probably the easiest would be to an elements inspector tool. Most modern browsers have this kind of tool automatically available in their developer tool suites.

With the inspector tool you can simply point to an element on the page, and see its properties. In the example below I am looking up the Infopath button.

Looking up the ribbon button id

Looking up the ribbon button id

Configurating an external data type in SharePoint 2013 Part 2

This is part two of the series on configuring an external data type in SharePoint 2013. The first part is here.

At this point you should have already finished configuring the external data type, and created a list based on that external data type.

When you are trying to access the list you get an “Access Denied by Business Data Connectivity” error. This is caused by your configuration of your Business Data Connectivity Service. To change that you have to:

1. Go to “Manage service applications” in central administration

2. Click on the “Business Data Connectivity Service”

3. Select your external content type and click “Set object permissions”

4. Give full permissions to All Users(windows)

5. Now you should be able to see your list

Configurating an external data type in SharePoint 2013 Part 1

This is a step by step configuration of an external data type in SharePoint Designer 2013. The first part explains step by step how to create an external data type. The second part shows how to configure the connection for fetching the data from an SQL Server database that is on another server.

So without further ado let’s get to the step by step description:

1. Open SharePoint Designer

2. Go to “External Content Types” and click the “External Content Type” button

3. You will get a window with the new external content type configuration

4. Change the name of the external content type by clicking on it

5. Go to sources configuration

6. Click “Add Connection”

7. For the source type choose SQL Server

8. Specify the database connection properties

9. Now you are ready to connect to the SQL database. Create a table in your database if you haven’t already.

10. Your source connection should now be visible in SharePoint Designer.

11. Now you need to generate the possible operations on the ProjectsTest table. Make a right click on the table an choose “Create All Operations”

12. On the “Operation Properties” screen click next

13. Check if the parameters are configured properly, and if you have no Errors in the “Errors and Warnings” screen.

14. On the “Filter Parameters” screen click next

15. You can now see the defined “External Content Type Operations”

16. Now we can create a new list based on the external content type that we’ve just created. Go to “List and Libraries” and on the ribbon click on “External List”.

17. Pick our external content type and click “OK”
18. Choose a name for out external list and click “OK”

19. If the SQL Server database is on the same server you should see the list.

If the SQL database is on another server, than you will see an “Access Denied by Business Data Connectivity” error. Handling this problem is covered in the next part of this tutorial.

Von anderen Sprachen abgeschaut

In jeder Sprache besteht immer die Bereitshaft, Wortgut aus fremden Sprachen aufzunehmen. Das passiert zum Beispiel, wenn sich eine Benennungslücke zeigt. Ein neues Wort wird manchmal auch mit einer neuen Sache übernommen. Idole werden in anderen Ländern gefunden, Technologie sind importiert, und Kulturgemeinschaft breiten sich aus. Die deutsche Sprache nimmt viele Wörter aus anderen Sprachen auf, wie Computer, Kultur oder Religion. Es ist auch sehr interessant, wie viele deutschen Wörter in anderen Sprachen gewandert sind. In der unteren Tabelle habe ich ein paar interessante Beispiele gegeben.

Die Sprache Ursprünglich Ausgewandertes Wort Bedeutung des ausgewandertes Wort
Finnisch die Kaffepause kaffepaussi außer Betrieb
Ungarisch Wie geht’s? vigéc der Vertreter
Afrikaans Kann nicht sehen kanitzeen boot das Unterseeboot
Franzözisch Was ist das? vasistas die Dachfenster
Polnisch Wie heißt er? wihajster das Ding

Man konnte also in z.B. Finnisch sagen, dass das der Fahrstuhl auf „kaffepausi“ ist :) Man muss dafür auch auf falsche Freunde aufpassen, die ziemmlich oft in der neuen Heimat des Wortes erschöpfen wird.

Polnisch für Anfänger – Der Satzbau

Polnisch ist weniger eingeschränkt als Deutsch, wenn es über die Wortfolge geht. Es ist möglich Wörte überall umzustellen. Man kann auch das Subjekt, oder das Objekt lassen, falls sie deutlich in den Satz sind. Der ganze Satz kann in verschiedene Weise geschrieben sein. Der Satz wird noch das selbe bedauten, doc er wird in ein anderes Kontext benutzt wird. Schauen wir uns an z.B. den Satz “Jakub hat ein Kaffee”. Alle folgende Sätze sind richtig, und bedauten das selbe:

Jakub ma kawę – Jakub hat ein Kaffe
Jakub kawę ma – Jakub ein Kaffe hat
Ma kawę Jakub – Hat ein Kaffe Jakub
Kawę Jakub ma – Ein Kaffe Jakub hat
Ma Jakub kawę – Hat Jakub ein Kaffe

Der am meinstens benutzt ist selbstverständlich der erste Satz, und die andere konnte man verwenden, um etwas zu betonen.

Falls vom Kontext ersichtlich, man kann der Subjekt, der Objekt, oder auch das Verb lassen:
Ma kawę – Kann verwendet warden, wenn es ersichtlich ist, worüber gesprochen ist
Ma – Der Antwort auf die Frage „Czy Jakub ma Kawę?“ (Hat Jakub ein Kaffee?)
Jakub – Der Antwort auf die Frage „Kto ma kawę?“ (Wer hat ein Kaffee?)
Kawę – Der Antwort auf die Frage „Co ma Jakub?“ (Hat Jakub ein Kaffee?)

Hauptsächlich “ja” (ich) und “ty” (du), und seiner Plural-Formen „my“ (wir) und „wy“ (ihr) sind fast immer gelassen.

Polish for beginners – sentence structure

Polish is much less constraint when it comes to sentence structure than german. It’s possible to move the words around. You can also drop the subject or the object if they are obvious from context. A sentence can be written in many different variations, while not changing it’s meaning. Different variations would be used in different contexts though. Let’s take a look a simple sentence: “Jakub has a coffee”.

Jakub ma kawę – Jakub has a coffee
Jakub kawę ma – Jakub a coffee has
Ma kawę Jakub – Has a coffee Jakub
Kawę Jakub ma – A coffee Jakub has
Ma Jakub kawę – Has Jakub a coffee

The most commonly used is of course the first sentence, and others could be used to highlight something.

Ma kawę – can be used if it’s obvious who is being talked about
Ma – answer for „Czy Jakub ma Kawę?“ (Does Jakub have a coffee?)
Jakub – answer for „Kto ma kawę?“ (Who has a coffee?)
Kawę – answer for „Co ma Jakub?“ (What does Jakub have?)

In particular, “ja” and “ty”, and also their plural equivalents “my” and “wy”, are almost always dropped.

Polnisch für Anfänger – Die Geschlechter

Mit diesem Artikel wollte ich eine Artikel-Serie für Anfänger über die Polnische-Sprache initialisieren. Diese Serie hat nich zum Ziel, um die ganze Polnische-Sprache zu beschreiben. Es geht hier um die Grundlagen zu vergleichen, und auf ein Paar interessanter Einzelheiten hinzuweisen.

In diesen Eintrag werde ich die Geschlechter beschreiben, und wie sie in die beiden Sprachen funktionieren. Das Substantiv in Deutsch hat immer ein Artikel. Der bestimmter Artikel für das männliches Geschlecht heisst der, für das weibliches die, und für das Neutrum das. Die Mehrzahl für alle Geschlechter ist die. Dazu kommen noch die unbestimmte Artikel. Für das männliches Geschlecht und Neutrum ein, für das weibliches Geschlecht eine, und die Mehrzahl hat keinem. Komplex, oder? Und das ist erst der Anfang. Der wahre Spaß beginnt beim Deklination J

Es gibt drei grammatische Geschlechter für polnische Substantive, nämlich männlich, weiblich und sächlich. Aber es gibt keine Artikel. Das Geschlecht eines Substantivs ist an seiner Endung im Nominativ Singular erkennbar. Männlich sind Substantive, die im Nominativ auf einen Konsonanten enden. Weiblich sind Substantive, die auf -a oder -i enden. Sächlich sind Substantive, die auf -e, -o oder –um enden. Viel einfacher, oder?

Polski dla poczatkujacych – rodzaje

Tym artykułem chciałbym rozpocząć serię na temat języka polskiego dla początkujących. Seria ta nie ma na celu omówienia całości języka polskiego, ale porównaniu podstaw, oraz wskazaniu kulku ciekawostek.

W tym wpisie porozmawiamy sobie o rodzajach, oraz jak są one wyrażane w tych dwóch językach.

Rzeczownik w języku niemieckim zawsze ma rodzajnik. Rodzajnik określony dla rodzaju męskiego to der, dla żeńskiego die a dla nijakiego das. Liczba mnoga dla wszystkich rodzajów to die. Do tego dochodzą rodzajniki nieokreślone. Dla rodzaju męskiego i nijakiego ein, dla rodzaju żeńskiego eine, zaś w liczbie mnogiej nie występuje (rodzajnik zerowy). Skomplikowane prawda? A to dopiero początek. Prawdziwa zabawa zaczyna się przy odmianie przez przypadki :)

W języku polskim również występują trzy rodzaje, męski żeński i nijaki. Nie ma natomiast rodzajników. Rodzaj rozpoznawalny jest po końcówce w mianowniku. Rzeczowniki męskie kończą się na spółgłoskę. Rzeczowniki damskie kończą się na –a, lub –i, natomiast nijakie na –e, -o, lub –um. Prawda, że proste ?

Polish for beginners – genders

With this article I will be starting a series on the topic of Polish for beginners. I am not claiming to introduce you to the whole of the polish language, but to compare some basic concepts, and point out some interesting facts.

In this article we will talk about genders, and how are they used in German, and Polish.

The nouns in German always have an article. The definite article for the male gender is der, for the female die, and for the neutral das. The plural form for all of the genders is die. There are also the indefinite gender. For the male, and neutral gender you´ve got ein, for the female gender eine, and in the plural form there is no article. Complicated, right? And that’s just the beginning. The real fun starts with the declination :)

In Polish there also are three genders, male, female, and neutral. There are no articles though. The gender is recognized by the ending of the noun in the nominative. The male nouns always end with a consonant. The female nouns end on –a, or –i, and neutral on –e, -o, or –um. Much easier, wouldn’t you agree?

Customizing the MySites masterpage in SharePoint 2010

I recently had the task of branding our SharePoint 2010. I just needed to change the main theme colors. I made a custom SharePoint 2010 theme (a good description of the SharePoint 2010 theming engine is here), and that did it for the main masterpage.

A problem came up thought with the MySites masterpage. It has an additional div area under the navigation pane.

MySites navigation area

MySites navigation area

Unfortunately theming this additional area is not supported in the SharePoint 2010 theme engine. I don’t really understand why. It is a basic theming matter, that should have been taken into account by the SharePoint team. But as with many others aspects of SharePoint, it is, what it is.

I finally resolved this by changing the style of the div section. To change it’s color for example you need to embed this code in the masterpage code.


<style type='text/css'>
DIV.ms-globalnav {
        background-color: rgb(174, 3, 3)
    }
</style>

How to programmatically deploy SharePoint 2010 Web Templates

Web Templates have been available in SharePoint already since the 2007 edition. I find that they are a really helpful feature, and provide a much easier and quicker way to set up a provisioning mechanism for SharePoint sites.

This blog post however is not dedicated to explaining what Web Templates are about. There is already some great material out there. Here are two links, that you should start with, to understand the pros and cons of web templates:

Vesa’s Juvonen great post, that goes into great detail about Web Templates:
http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx

Miriam van Olst post about Site Definitions vs. Web Templates
http://sharepointchick.com/archive/0001/01/01/site-definitions-vs.-webtemplates.aspx

A tutorial on how to save a site as a Web Template, and what goes into it.
http://office.microsoft.com/en-us/sharepoint-designer-help/save-a-sharepoint-site-as-a-template-HA101782501.aspx

Ok, so you now decided, that you want to use a Web Template. It’s pretty straightforward and well documented how you can do it manually, but how to do it in code?

Step 1: Save the site as a web template(as explained in the article linked above), and download the created solution file.

Step 2: Upload the solution file to your solution library, and activate it.

SPSite currentSite = SPContext.Current.Site.Solutions;
string templateName = 'TestTemplate';
SPUserSolution userSolution = null;
SPFile solutionFile = null;
string templateFilePath = @'\Templates\TestTemplate.wsp'

// Gets the solutions gallery for this
SPDocumentLibrary solutions = (SPDocumentLibrary)site.GetCatalog(SPListTemplateType.SolutionCatalog);

// Check is a solution file with this name already exists. If it does, delete it.
if (!site.RootWeb.GetFile(templateName).Exists)
{
userSolution = (from SPUserSolution s in currentSite.Solutions
where s.Name == solutionName
select s).FirstOrDefault();

if (userSolution != null)
site.Solutions.Remove(userSolution);
}

// Upload the solution file
solutionFile = solutions.RootFolder.Files.Add(templateName, File.ReadAllBytes(filePath), true);

// Activate the solution
if(solutionFile != null)
userSolution = site.Solutions.Add(solutionFile.Item.ID);

Step 3: Activate the site collection feature for the template.

Guid solutionGuid = userSolution.SolutionId;

SPFeatureDefinitionCollection siteFeatures = site.FeatureDefinitions;

var featureDefinitions = from SPFeatureDefinition f
in siteFeatures
where f.SolutionId.Equals(solutionGuid) && f.Scope == SPFeatureScope.Site
select f;

foreach (SPFeatureDefinition featureDefinition in featureDefinitions)
{
if (GetFeature(site, featureDefinition.Id) == null)
site.Features.Add(featureDefinition.Id, false, SPFeatureDefinitionScope.Site);
}

Afther that your template will be available for you to use.

Happy coding.

Amazon Kindle dictionaries rant

Today I wanted to get out a little rant about Amazon Kindle dictionaries. I also wanted to say hi, to my regular readers (hi mom). Just kidding. Even my mom doesn’t read this blog.

When I first heard about e-book readers, I was stunned. This was the kind of product, that I always wanted. I love to read, but books have always been expensive in Poland, and the titles that I wanted to read seemed always not available in my native land.

The second thing is language learning. I am a big fan of diving in the language as soon as possible, and getting to real world content. For me the “My name is John. How do you do” type of learning material is boring. So when I’ve learned, that the Kindle had a real time dictionary function, I didn’t think much and ordered the than newest 3 generation Kindle.

Than came my biggest disappointment. Yeah, the English dictionary that comes with the Kindle is great, but all of the others dictionaries sucked. The German-English dictionary didn’t recognize conjugated verbs, witch made it a pretty useless in my point of view to anyone. The French-English dictionary the same. I thought, ok, maybe it’s a really big effort to make such a dictionary, and Amazon simply doesn’t have the resources (naive, I know). Then I found this:

http://www.depl.pl/kindle.zip

The dictionary was prepared by Robert Kopias for http://www.depl.pl/. I tried it out, and was amazed how good it was. It’s not perfect, but compared to what is available in the Kindle store it’s amazing.

At first I thought, that maybe It’s just a matter of time, before this market gets developed, but I’ve been waiting already for 2 years, and the landscape hasn’t really changed much. Come on Amazon, move your fat corporate butt!!!!

PowerShell SharePoint snapin adding scriptlet

If you ever tried to run a SharePoint script, and did not do it from the “SharePoint 2010 Management Shell”, you know what I mean. You got something in the lines of:

“The term x is not recognized as a cmdlet, function, operable program, or script file, blah blah blah”

That’s because the “SharePoint 2010 Management Shell” besides running PowerShell also loads a snapin with SharePoint cmdlets. You have to do that too. Behold the code:

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq ‘Microsoft.SharePoint.Powershell’}

if ($snapin -eq $null)
{
Write-Host “Loading SharePoint Powershell”
Add-PSSnapin “Microsoft.SharePoint.Powershell”
}

You just copy and paste this on the beginning of your PowerShell script, and voila. You can now say bye bye to the “SharePoint 2010 Management Shell” shortcut.