[DE] MCM/MCSM/MCA abgekündigt – Ende einer Ära

Mein erster Blog Post auf deutsch…

Wie Ihr sicher bereits gehört habt wurde der Microsoft Certified (Solutions) Master und Microsoft Certified Architect von Microsoft am Freitag überraschend abgekündigt. – Nicht nur SharePoint: alle 4 Zertifizierungsprogramme wurden abrupt beendet.

Das ist die schlechteste Nachricht, die ich in meiner beruflichen Laufbahn je bekommen habe.

 

Voller Text hier:

http://blogs.technet.com/b/neiljohn/archive/2013/08/31/retiring-the-microsoft-master-certifications-and-training.aspx

 

Erste Artikel hier:

[von MCM Wictor Wilén] http://www.wictorwilen.se/microsoft-advanced-certification-mca-mcsm-mcm—the-end-of-an-era

[von MCM Paul Stork] http://www.dontpapanic.com/blog/?p=328

[von MVP Jeremy Thake] http://www.jeremythake.com/2013/08/mcm-certs-gone-microsofts-cloud-reality-distortion-field-in-full-force

http://www.theregister.co.uk/2013/08/31/microsoft_cans_three_pinnacle_certifications_sparking_user_fury/

http://www.zdnet.com/microsoft-abruptly-pulls-masters-certification-hints-a-replacement-may-come-7000020093/

 

Hier könnt Ihr Microsoft Eure Meinung sagen:

https://connect.microsoft.com/sqlserver/feedback/details/799431/please-dont-get-rid-of-the-mcm-and-mca-programs

 

Ich war noch im Juni diesen Jahres in Redmond zur Rezertifizierung für MCSM: SharePoint.  Das werde ich bis zum 1. Oktober nicht mehr abschließen können. – Und: Warum sollte ich es noch abschließen, auch wenn das möglich wäre? Sinn macht es so oder so nicht mehr. – Aber ernsthaft: 30 Tage Zeit für eine solche Aktion?! Meine (wenigen) grauen Haare verdanke ich den letzten 17 Monaten, in denen ich erst den MCM abgelegt und mich dann für den MCSM vorbereitet habe. – Besonders verstörend empfinde ich dabei, dass meine Kollegen und ich aus “R15” (“Rotation 15” = Zertifierungsdurchgang ab Juni 2013), letzte Woche (26.08. bis 29.08.)  noch in die Prüfung geschickt wurden obwohl den Verantwortlichen (offensichtlich) längst klar gewesen sein muss, dass die Zertifizierung Geschichte ist.

 

Eine Analyse, welche Hintergründe die Entscheidung haben mag, möchte ich an dieser Stelle nicht führen, denn das Ergebnis ist offensichtlich. Ich frage mich dieser Tage, wie weit Microsoft die “Cloud”-Strategie noch treiben wird. Ist es tatsächlich deren Ziel, beste Software-Produkte in den Wind zu schlagen und die Kunden quasi zu zwingen, sich Alternativen zu suchen? “Cloud” an sich ist nichts schlechtes, aber “nur Cloud” ist einfach Quatsch.

 

 

Set profile synchronization account rights in AD using PowerShell

This is just a short note on this topic. I could not find a script in the net. I’m not sure this is part of some SharePoint “config frameworks” like “AutoSPInstaller”. I do not use this frameworks. I create my own script sets. – Currently I create config scripts for my dev environment… The missing pieces here are related to User Profile Sync. Creating a sync connection *not* using Central Administration is not supported. There is no PowerShell, etc. – Another thing is to grant the sync account rights in the Active Directory… Here is my small script in Technet Gallery:

http://gallery.technet.microsoft.com/Set-SharePoint-profile-1a3d1283

The script will not modify an existing entry for the profile sync user in the AD. If the user is in the ACL of the Domain object or the Configuration object it will skip this part!

As always: Use it at your own risk!!! 

image

Use it like this:

image

 

Tested with SharePoint 2013 and a Active Directory based on Windows Server 2012.

SharePoint 2013 List Forms: New Small Framework Project to Store List Forms in SharePoint Library (Part 1)

I spend some spare time in the last weeks and the last days (in Redmond before the MCSM: SharePoint rotation starts in a few hours 😉 ) for a new private development project. It focuses on custom list forms for SharePoint 2013. – Another article of my blog is one of the most recognized one regarding to the statistics: https://blog.kenaro.com/2010/12/29/walkthrough-create-custom-sharepoint-2010-list-form-for-deployment-in-a-visual-studio-2010-project/ – So I decided to write another article in this context in connection with another plan of mine to create a small framework to enable custom list forms that are stored directly in a SharePoint document library and which are connected with the content types automatically.

I release the source code there:

http://splistforms.codeplex.com

There is no “binary distribution”, because it’s “alpha“. – You will use it at your own risk – as always. Remember: It’s a private development project and I publish it for demonstration purpose only!!

 

These are the goals:

  1. Create a SharePoint list where list forms for content types are registered. – When creating a new form in this list it gets automatically registered on the content type.
  2. The list form has 3 different form modes: New, Edit, Display. All can be set individually.
  3. The list forms are rendered by using controls stored in a SharePoint document library. – The default SharePoint “Rendering Template” mechanism is used.
  4. The custom list form control can be edited with SharePoint Designer or by using another Editor by opening the control file in a mapped network drive.

 

All this based on SharePoint rendering templates. There are lot of articles out there that cover that topic.

Some information here:

Each content type in SharePoint has some properties related to “form templates” that can be set using C# or the declarative way.

Let’s have a look into the settings of the content type “Item” of a simple custom list.

Here you see all form templates are set to “ListForm”. That is the default setting. – Other lists such as task lists use different default settings like this:

 

“ListForm” and “TaskForm” are so called “rendering templates” that is taken from a certain file in the 15 hive: <15>\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx

Looking into the file:

Here you find the rendering template “ListForm”. It defines how to create the forms HTML codes at rendering time. – Look at the “ListFieldIterator” tag. It will generate HTML code for all the fields in a SharePoint list. It’s very generic!! (The whole rendering mechanism is one of my favorite peace of code of SharePoint J )

Also for rendering the fields (“columns”) there are rendering templates that will be used by the “ListFieldIterator” at some point of rendering. For example:

You can create your own rendering templates for use with content types. Just add a .ASCX file to the CONTROLTEMPLATES folder of the 15 hive that contains a rendering template in this fashion. (You cannot use a sub folder below CONTROLTEMPLATES!!) Then set the property of the content type to the rendering templates name and it will be used to render your list form. – This is what my framework does.

 

In the first article I want to show you the result of this project.

In the second article [coming soon] I want to show you how it works behind the scene of the framework.

In the third article [coming soon] I want to show you how to create a SharePoint project to deploy custom list forms that uses the framework.

 

Let’s start…

 

1. To start the demonstration I need to create a simple custom list with some columns. I name the list “Simple Demo List” and create 4 columns:

  • “Date” => date and time column
  • “MultiText” => multiple lines of text column
  • “User” => person or group column
  • “YesNo” => Yes/No column

 

2. This is how the default new form of the list looks like:

 

3. Now I want to create my own list form for this list using my brand new framework. – Therefore I want to show you the two lists and one library it consists of:

  • “List Forms” : This list contains all custom form registrations made by the framework. Here you can create new forms. An event handler will create the controls derived from the chosen templates register them on the content types.

     

 

  • “List Form Controls” : This library contains the list form controls, the templates and additional jQuery libraries.

     

 

  • “List Form Templates” : In this list you can register new templates that will be used to create new forms.

     

     

    This is a simple list that refers to the “Templates” folder of the “List Form Controls” library:

     

 

4. Now I want to create a “New Item” form my “Simple Demo List”. Therefore I add a new item to the “List Forms” list:

Here you enter all information needed to identify the content type for which you want to create form. You can choose a form template. I have included to kinds of templates:

  1. Plain templates that use the same rendering template as the SharePoint default “ListForm” template.
  2. jQuery enabled form templates that allow you to use jQuery for customizations.

I choose “New jQuery” as template.

Before we hit “Save” let’s have a look at the content type using PowerShell. (It’s the same screenshot as above in the “rendering template” excursion at the beginning of this article…)

All forms are set to their defaults: “ListForm”

Now I hit “Save” on the new “List Forms” list item to create my own form.

After that the list view of “List Forms” looks like this:

What happens here:

  1. The chosen template file is taken from the “Templates” folder of the “List Form Controls” library. A new name is created using the naming template “SimpleDemoList-New-<GUID>”. The new control is saved using this name in the root folder of the “List Form Controls” library.
  2. Inside the new control file there is a template for the list columns. This template will be taken and reproduced for each (visible) field (list column). Then the template in the new control file is replaced by the list column entries. – Here is the template file:

    The whole template between the marks “LISTFORM_FIELDPLACEHOLDER_BEGIN” and “LISTFORM_FIELDPLACEHOLDER_END” will be instantiated for each list column. Inside all marked placeholders (“LISTFORM_FIELDINTERNALNAME”) will be replaced by the list columns internal name.

  3. Than a new rendering template is registered on the list content type “Item” on the “Simple Demo List”. – Let’s look into it using PowerShell again:

    Now the “NewFormTemplateName” is “ListFormNew379E”. This is the indicator that my framework will be responsible for rendering the list form.

  4. Let’s have a look into the “List form Controls” library. Here you will find the new control:

  5. I open the control using a mapped network drive:

    In it you see HTML code sections for each list column. These entries are generated automatically using the template file and the “item template” inside the template file.

5. Now let’s use the new form. Just open the list view of “Simple Demo List” and hit “New Item”.

This is our jQuery enabled form!! It works in an instant!!

The text “jQuery loaded” is generated at runtime when jQuery could be loaded. (This can be removed of course.) – This framework supports loading jQuery from library “List Form Controls” if it’s not present though the page, e.g. the master page. It also supports loading additional libraries.

To support jQuery and to allow you to use if for your own purpose there are two controls in the control file:

The first one (“LoadJQ”) is responsible for loading jQuery and additional libarires. (One library per line in “AdditionalLibraries”. Supported placeholders are: “~site” for the server relative site collection URL and “~web” for the server relative web URL.)

The second one (“JQSupporter”) can be used to store own code. As an example I’ve replaced the default “PreSaveItem” handler of SharePoint with my own handler in order to support my own validation mechanism before saving the item to be able to cancel the save action.

6. Now I want to add some new functionality to my control. Let’s say we want to ensure that title has at least 10 characters.

Therefore I modify the JQSupporter control in the control file using Expression Web 4 on the mapped network drive.

The “$$” I’ve used there will be replaced at rendering time with the ASP.NET ClientID of the List Form. This should be used to prevent naming issues. (To use “$$” as characters inside the script just use “\$$” as escape sequence.)

The variable “listform$$_ctrl_Title” is generated automatically by the JQSupporter control. For each visible list form control you will get such a variable “listform$$_ctrl_<FieldInternalName>“.

This is how the source looks like at client side:

   

Let’s test it:

It works. J

 

7. Now you are able to customize forms very quickly. “Normal” users only need read permissions on the lists/library “List Forms”, “List Form Controls”, “List Form Templates”.

All settings should be part of a normal SharePoint backup, e.g. Backup-SPSite. I’m not sure it would be part of an SharePoint Export. … I checked the exports Manifest.xml file and I can see the content types form setting is exported. Because of all controls and settings are in SharePoint lists and libraries it should be possible to include this in a SharePoint Export/Import or deployment process. – It should be possible too to save the settings in a site template. (However… you always need to add the SharePoint solution as full trust solution to your farm.)

 

Limitations:

  • It’s alpha!!!!!!!!!!!!!!!!!!!!!!
  • It is hardly tested!!!!!!!!!!!!!
  • It does not support removing the custom form from the content type. – That can be done through PowerShell by setting the form property back to the default value (“ListForm” or “TaskForm” or what ever…).
  • It should work with site content types but I’ve not tested it yet. I have commented out it.
  • It does not handle errors if they occure.
  • It’s not performance tested!
  • It has no management interface. Only the lists and libraries I’ve described above. They should be hidden. You could hide them easily.

Next steps:

  • Management interface
  • “Remove List Form” support for event handler on list “List Forms”
  • Field Rendering Templates.

Please feel free to make comments if you like it – or not like it.

InfoPath error & solution: InfoPath cannot open the following form … The file is not a valid XML document.

Yesterday I had a problem on a new SharePoint 2013 farm that took me some hours to solve it.

Problem:

I was not able to customize forms (again) using InfoPath on lists after creating them before sucessfully.

 

Steps to reproduce:

First I created a site collection and a custom list in it.

image

Than I use the “Customize Form”  button in the Ribbon menu. The new form opens in InfoPath designer.

image

Than I modify the form and publish it.

image

In the  browser I verify it’s working.

image

Than I want to change the form and click the Ribbon button “Customize Form” again.

image

Now this happens:

image

Error Message:

InfoPath cannot open the following form: http://sharepoint.local/sites/test/Lists/My New List/Item/template.xsn
The file is not a valid XML document.
DTD is prohibited.
Line 1, Position 9

When opening the URL of the InfoPath template in the browser I get this error from the Forms Server:

image

(Normally there would be a download dialog.)

 

Solution

It’s so simple… 😉 – After some network, log and code analytics I could figure out that you need…

… a site collection at the web application root!

Remember the first screenshot above. There I showed you the possible locations for the new site collection. As you can see the root “/” is available. This means: There is no site collection at the web app root.

image

After creating a site collection at the web application root I’m able to customize the list form with InfoPath. – After doing so:

image

Problem solved 🙂

 

My friend and colleague Guido could reproduce the problem and validate the fix. – @Guido: Thank you (and have a good week while teaching SharePoint 😉 )!!!

 

Hints

As far as I have seen there are other solutions related to the same problem:

  • Check your user has at least Contribute rights on the site.
  • Check your site is in “Local Sites” or “Intranet” zone of the Internet Explorer.

Guest Blog Article on Hey, Scripting Guy! Blog – Weekend Scripter: Run C# Code from Within PowerShell

http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/30/weekend-scripter-run-c-code-from-within-powershell.aspx

Link to “C#Script”: http://gallery.technet.microsoft.com/C-Script-Execute-plain-a9eae961

image

Update of PS2EXE: Version 0.4 now support Single and Multi Thread Apartment and “NoConsole” mode

On Codeplex user redpark asked for “Single Thread Apartment” mode (http://ps2exe.codeplex.com/discussions/435946)…

Here it is…

Please see v0.4 on CodePlex:

http://ps2exe.codeplex.com.

 

There are 3 new parameters:

-sta Single Thread Apartment mode

(see http://msdn2.microsoft.com/en-us/library/system.stathreadattribute(VS.71).aspx)

-mta Multithread Apartment mode

(see http://msdn2.microsoft.com/en-us/library/system.mtathreadattribute(VS.71).aspx)

-noconsole resulting EXE is an Windows application not a console application.

 

The –noconsole parameter lets you create a Windows application EXE file with no console window.

Therefore I would need to implement several extensions for the PowerShell host included in the resulting EXE but currently I have not enough time to do this. But for now I’ve implemented the credential prompt so cmdlet Get-Credential will work as expected.

PDF UPLOAD METADATA EXTRACTOR (sample SharePoint 2013 & 2010 project) on Codeplex

When you upload MS Office documents to SharePoint document libraries their document titles are used in SharePoint to set the default Title column of list item of the uploaded document.

This does not work for PDF files, but it’s easy to reproduce the functionality.

I have created a simple VS2012 SharePoint project. It’s based on the C# (“iTextSharp”) version of the community version of iTextPDF (http://itextpdf.com) that can be downloaded here: http://sourceforge.net/projects/itextsharp/files/itextsharp/

You can download source code and solution packages (“binaries”) from Codeplex:

http://sppdfmetadataextract.codeplex.com/

The project is published under LGPL license because iTextSharp v4.1.6 requires that. – The latest version of iTextSharp (5.3.4) is published under AGPL. Codeplex does not provide AGPL licencing. So I had to use the last version of iTextSharp published under LGPL.

 

Description:

1. On (Web-) feature activation an feature event receiver iterates through each document library in the web that is not hidden.

2. For each of them the feature event receiver registers a list item event receiver that fires on “ItemAdded” events.

3. Furthermore an list item receiver is installed for the web to fire on “ListAdded” events to register the list item event receiver mentioned before on newly created lists.

4. During upload of files to document libraries the list item event receiver look for files ending with “.pdf” (case insensitive).

5. If there is such an file it opens the file using iTextSharp library and reads its “Title” information.

6. This information is set for the default “Title” column of the SharePoint list item.

7. The change is commited by “SystemUpdate” on the SPListItem object.

8. If an error occures inside the event handler there is no action. The user will never see an error in the module. If it is not possible to extract the title of the PDF document the module will not set the title column of the list item.

 

Usage:

To use the feature just deploy the SharePoint Solution Package (WSP-file) to your SharePoint farm. It’s not a “sandboxed solution”! After that you need to activate the feature in each web where you need it. If you need to activate it on each new web you could use “feature stapling” to activate it by default. If you need this please write me an comment.

Demo in SharePoint 2010:

1. Create a Word document with a title and save it as PDF:

SNAGHTMLb6b29ba

 

SNAGHTMLb6bd515

2. Check the document title by using Adobe Reader or Adobe Acrobat or any other PDF reader

SNAGHTMLb6da159

3. First try to upload the DOCX and it’s PDF into a document library without the new feature activated on the web:

image

As you can see: The “Title” of the DOCX is used for the Title column of the SharePoint list item. For the PDF file the Title column is empty.

4. Now activate the feature:

image

5. After that delete the files uploaded before in the document library. Than upload both files again:

image

Now both “Title” columns are set!

6. My last test is to create a new Asset libary in the web. Than I upload both files and check the PDF’s properties:

image

The Title column is set as expected!!

Demo in SharePoint 2013:

I’ve added a second project just for SP2013. Here is a single screenshot…

image

Gimmick: Write To SharePoint Log using PowerShell functions

In preparation for a deployment project I wrote some PowerShell functions to write messages to the SharePoint ULS.

You can download the PowerShell script here: http://gallery.technet.microsoft.com/Write-Messages-to-b59565bf

There are some samples in the package.

image

This is what it looks like in ULSViewer:

image

Red = Area or “Product” in ULSViewer

Green = Category

Blue = Severity Level

Purple = Message

 

You can use the script file “SPLogging.ps1” as PowerShell module. In the following sample the SPLogging.ps1 file is stored in the same location as “SPLoggingDemo.ps1”. Or you copy the content of “SPLogging.ps1” to your own file.

Import-Module "$(split-path $MyInvocation.MyCommand.Path)\SPLogging.ps1"

Here are some samples about how to create “Areas”

 

Add-SPDiagnostigLoggingArea -AreaName "TestArea"

"PowerShell", "PS1", "PS2" | Add-SPDiagnostigLoggingArea 

This is how you create categories:

Add-SPDiagnostigLoggingAreaCategory -AreaName "TestArea" -CategoryName "Category1" -TraceSeverityDefault High

Add-SPDiagnostigLoggingAreaCategory "TestArea\Category2" -TraceSeverityDefault High

"Test1", "Test2", "Test3" | Add-SPDiagnostigLoggingAreaCategory -AreaName "PowerShell" 
"Test1", "Test2", "Test3" | Add-SPDiagnostigLoggingAreaCategory -AreaName "PS1" 

You can add new categories by specifiying the area and the new category name seperatly or as formatted string: <area><backslash><category>

The following snipped shows you how to query the areas and categories you created in your PowerShell session.

Get-SPDiagnosticLoggingCategory -CategoryName "PowerShell\Test1"

Get-SPDiagnosticLoggingCategory -AreaName "PowerShell"

Get-SPDiagnosticLoggingCategory 

You have only access to your own areas and categories!!

Finally here are some examples of how to write messages to the SharePoint ULS. You can use PowerShell pipelining!

Write-SPDiagnosticLogging -CategoryName "PowerShell\Test1" -Message "Hello 1!" 

"Hello 2!" | Write-SPDiagnosticLogging -CategoryName "PowerShell\Test1" 

"Hello 3!", "Current date/time: {0}" | Write-SPDiagnosticLogging -CategoryName "PowerShell\Test2" -MessageArguments @(([DateTime]::Now)) -TraceSeverity "High"

 

Writing to the Windows Event Log is not supported at this moment.

How To: Use Git for small dev projects with “private” GIT repositories based on cloud storage providers such as SugarSync or DropBox

In some small dev projects in the last months I was looking for a source control system. I liked to use Microsoft’s Team Foundation Services. But I was and I am not able to use them with my current VS 2010. I cannot use the final version (http://tfs.visualstudio.com) because of a bug in (my?) Visual Studio. (Forum thread related to this problem: http://social.msdn.microsoft.com/Forums/en-US/TFService/thread/1b6673ec-8c42-4896-9049-49f17b85bf65)

Anyway…

So I wonder if I could use Git. – It’s a “[…] a distributed revision control and source code management (SCM) system with an emphasis on speed.” (Source: Wikipedia).

There is GitHub.com where you can host public visible projects for free. For “private” projects you have to pay (https://github.com/plans). The pricing is fair! But I was looking for a cost opportunity.

For cloud storage purpose I’m using this cloud storage providers:

(For data protection on cloud storage I use BoxCryptor.)

For this article I use SugarSync.

In my scenario I have some source code to share between me and other project members. We like to code together. And we need some source control features… With a cloud storage provider I can share local folders with other people… So now:

My aim is to create a cloud storage based source code repository for a small project and share the repository with other developers to work on the same project. My aim *is not* to describe the basics of and the need for source control in software development. (And I do not describe why to do all the steps 😉 )

This are the step to do so:

  1. Download and install Git for Windows: http://code.google.com/p/msysgit/downloads/list: “Full installer for official Git for Windows 1.8.0 Featured Beta”
  2. Download and install Git Extensions: http://code.google.com/p/gitextensions/downloads/list: “Git Extensions 2.43 Windows installer”. This are some very usefull “GUI” extensions for Git.
  3. Download and install Git Source Control Provider for Visual Studio (2012, 2010, 2008): http://visualstudiogallery.msdn.microsoft.com/63a7e40d-4d71-4fbb-a23b-d262124b8f4c
  4. Download and install – if you like – PowerShell extensions for Git: https://github.com/dahlbyk/posh-git
  5. Register for a cloud storage, e.g. SugarSync.
  6. Download and install the cloud storage software on your dev machine and log in.
  7. Open Visual Studio and create your project as normal. Or open an existing project. It’s the same procedure in both situations.

    image

  8. Right click on the project node or solution node in the Solution Explorer and click “Create Git Repository”

    image

  9. Right click on the project and “commit” the changes.

    image

    image

    image

  10. Open Git Shell (PowerShell or Bash), navigate to the project source folder.

    image

    Here you can see that to source folder is recognized as Git enabled folder.

  11. The next step is to create the connection to the repository that is shared between project members.
  12. Create a local folder for your Git repository and map the folder to your cloud storage.

    image

    image

  13. Create an empty folder inside the local repository folder. In this folder the project repository will be created.

    image

  14. Open Git Extensions and create a new repository:

    image

  15. Now you need to connect the local project folder with the repository.
    • git remote add origin “//localhost/c$/github/test project 1”

      image

  16. The next steps are to create a remote branch and to connect the local branch (“master”) with the remote branch
    • git push origin master:refs/heads/master

      image

    • git branch -u origin/master master

      image

  17. Now you can use “git push” to upload local changes to the repository and “git pull” to download changes from the repository to the local project folder.
  18. The final step is to share the cloud storage hosted folder with other project members:

    image

    image

That’s it for the publisher.

The next step is that an invited project member needs to sync the repository folder to it’s local drive and do the following steps:

  1. I simulate this by creating a new local project directory “c:\source\test project 1 other member”.

    image

  2. Then initialize the directory with “git init

    image

  3. Now you need to connect the local project folder with the repository.
    • git remote add origin “//localhost/c$/github/test project 1”

      image
    • git pull origin master:refs/heads/master 

      image

  4. The last step is to set the local branch to “track” the remote branch.

    image

That’s it, again. This are the basics about how to create a local project, a cloud hosted repository, how to share the repository and how to connect to it on a project members site.