Archive

Archive for April, 2012

Add new file type in SharePoint

April 23, 2012 14 comments

Out of the box, SharePoint can manage lot of file type. This management include the capability to show an Icon, to index, to open from browser and finally to Index. But what if you need to manage another file type?

There are 2 steps to complete:

  • Specify Icon File and activeX control to use for extraction/archiving
  • Allow Content Type to open from Internet Explorer

In this example I’ll use keepass, a pretty useful password manager, file format to enable to SharePoint

Before :

I added a KDBX file into a SharePoint Library (my Preciious.kdbx), there is no icon, Internet Explorer only allow saving, no opening… Poorly integrated.

Image Icon and Opening

First step is to add a File icon in 14/Template/Images folder. My recommendation is to use a .PNG 16×16 pixel PNG picture with transparency.

Now next step consist in register this picture. To do this edit file 14\TEMPLATE\XML\DOCICON.XML, and add this line somewhere in the <ByExtension> section:
<Mapping Key=kdbx Value=KeePass_icon.png EditText=Keepass Password Manager  />

This associate the file extension .kdbx to the KeePass_Icon.png image. Optionally you can specify the text to add to contextual menu (what we did here) and even specify an ActiveX Control to fire when opening document. But in our case, we don’t have any ActiveX to call. (More info Here ).

Well this what we have so far (mind the EditText value):

Allow Content type opening

So, our file type now have an Icon. That’s great, but you still can’t open file directly from SharePoint: Internet Explorer do not allow open file :

That’s because SharePoint by default, send specific HTTP Header when transmitting file that have not recognized Mime type. The get rid of this, there is two option:

The best you can declare document mime type as “downloadable“. That’s easy when you are working with specific content type but .kbdx file do not have specific mime type. No problem, let’s create a custom Mime type on IIS server ! Here is how to do:

Open IIS console, select server node and open “MIME Types” menu

Then click “add…” button to declare de specific Mime type. Custom mime type should begin with application/vnd. OK, it’s time to be creative:

Now, last step is to declare this Mime type as “Downloadable” this can be done via a PowerShell cmdlet:

$web=Get-SPWebApplication -Identity <WebApplication>
$web.AllowedInlineDownloadedMimeTypes.Add(“<Custom Mime Type>”)
$web.Update()

Declaring custom MIME type and set it as downloadable is not mandatory, another solution is to set the “Browser file Handling” option to “permissive” in Web Application general settings (Central Admin/Manage Web Applications/<Web application>/ General Settings application)

This is quick, but not really secure, I really suggest that you choose first option.

And voila! You are now able to open file directly from SharePoint. Of course it support Extraction/Archiving

Ressources:

Categories: SharePoint 2010

Move-SPUser common errors

April 19, 2012 Leave a comment

There is something great with ladies: they change their name when get married .There is something SharePoint do not like: when people change their Name…

When user change their AccountName, SharePoint do not “see” it very well. You have to use the Move-SPUser cmdlet (or stsadm –o migrateuser for Moss 2007)

Technet documentation (Here) give this example:

Move-SPUser –Identity “DOMAIN\JaneDoe” –NewAlias “Domain\JaneSmith”

But if you try it, this command fails. Because the identity parameter shall not be a String, but an SPUser object. Instead try this:

$user= Get-SPUser -Identity <LoginName> -Web <A WebSite in your Farm>
Move-SPUser –Identity $user –NewAlias “Domain\newLogin” -IgnoreSID

And if this command fails in a “User unknown” error, you should try to launch it under Identity Account.

To sum-up:

  1. Log as Identiy Account
  2. Do a get-SPUser first

Thanks to http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/92e515a0-7b4f-4597-95ba-ec640810ac0c

Categories: SharePoint 2010

Profile Sync and Claims Authentication

April 17, 2012 Leave a comment

This article is a re-post from my previous blog… This is something that is not well documented, but you can have a profile synchronization for federated-based authentication. Follow this steps. First, create de connection sync, specifying an Active Directory type, and Claims-Based authentication provider,


Once this is done, you have to map a specific profile property Claim User Identifier (SPS-ClaimID) to the claims that is used as identity claims. This claims is visible using this small powershell cmdlet:

$provider=Get-SPTrustedIdentityTokenIssuer 

$provider.IdentityClaimTypeInformation

Commonly, the Identity Claims used is emailadress. Go in “Manage User Properties” , find the “Claims User Identifier” and edit it. Go in “Add new Mapping” section, and add an Import connection to the mail Attribute (or the property you used as identifier) of the source data connection you previously created. Now start a full sync and voilaaa! All your AD Accounts are no synchronized with a claims-based account, not the basic DOMAIN\Account.


What if you want to use profile sync using both Claims-based and integrated authentication? Well even if the profile would be match to 2 different account name (the DOMAIN\Account and the i:bar-foo), they are consider as a duplicate account by FIM, and there will be just one account sync. For instance, my AD account is in a OU that is sync by a n integrated authentication provider and a claims-based one. So when I query the FIM meta verse, I appear twice :


Once with the Windows Claims providers


And once with the adfs-fedrated claims provider:


But if I try to see the preview, my account appears as twice:


So the only way to achieve a domain sync against claims-based authentication AND Integrated-based authentication is to sync different OU of the AD domain.

ASAOW : SharePoint Tag Cloud using Deep refiners in Fast Search by Amit Kumawat

April 13, 2012 Leave a comment

Once A week, I try to post a link to an « Amazing SharePoint Article Of The Week » (ASAOW).

This is common request from customer that is poorly documented (from my point of view): How to create a Search Refine for Fast? Amit Kumawat wrote a really great article, explaining how integrate such a refiner and even how to calculate the size of a term in a tag Cloud.

Amazing job, article is here: http://extreme-sharepoint.com/2012/04/10/sharepoint-tag-cloud-deep-refiners-fast-search/

For more information about custom search refiner with SharePoint 2010 search, I suggest this article: http://www.itidea.nl/index.php/search-refiners-part-1-expanding-the-ootb-search-refinement-panel/

ASAOW : Sharepoint Variations – The Complete guide by Stefan Gossner

April 12, 2012 Leave a comment

Once A week, I try to post a link to an « Amazing SharePoint Article Of The Week » (ASAOW).

Stefan is writing (one final part missing) an amazing guide about this not-so-well-known feature.

For memo, variation consists in publishing a SharePoint site in different languages.

More info here:

More to comes….

Blog is moving on WordPress

April 12, 2012 Leave a comment

Hi, after trying for months I have to give up: I’m moving my blog from SharePoint to WordPress.

I have to admit that SharePoint is really a great platform, we can do many amazing thing. But from my experience, getting a fully functional, nice and mobile-compatible is a long process that requires lot of energy and smartness. I’d rather to preserve this energy for our customers!

Many drawbacks I’ve experienced came from anonymous mode on Blog site template. I had 4 major issues:

  1. LockDown Feature involve Authentication (Guys Really? http://www.sharepointblues.com/2010/12/22/blog-site-in-anonymous-use/)
  2. Custom Xsl for anonymous user and ListViewWebpart do not works (http://social.technet.microsoft.com/Forums/en-us/sharepoint2010customization/thread/3d95f279-91c0-47be-b7b9-3a0f83ff4f8c )
  3. Managing anonymous comments aprovement is far to be easy. many others move comments on disqus.com
  4. You have to be well css-skilled to get a pretty design. And realllly, I’m a kind of CSS-Phobic

So I gave up. I’m moving to wordpress. From there I can easily manage my posts, comments,site theming etc…

Categories: SharePoint

SQL Server 2008 /2008R2 : Shrink LDF Files

April 10, 2012 2 comments

This is a common issue, by design, LDF files associated to databases are not shrink, and size may became huge. Sometime, you have to manually shrink them. Here is how to do:

First : DO NOT CHANGE recovery mode to simple, then turning back to “Full”. This is a heavy operation that under (pretty rare indeed) circumstances may corrupt some data.

Instead, do the following:

  1. Backup transactional log via SQL Server Manager (Right Click>Tasks>Backup> choose backup Type: Transaction Logs)

This will, backup and flush the LDf file, now you have to do a checkpoint. This will move the active section of log to move at the beginning of it.

  1. To achieve this Checkout, start a “new Query” windows after selecting database, and simply type “Checkpoint
  2. Now, backup transaction Log again (you can use same file as the first backup)
  3. Shrink file using right click>Tasks>Shrink>File and specify Log as file Type and hit Release unused space radio button

Click OK, the file is now shrinked 😉

Thanks to Christian Robert : http://blogs.developpeur.org/christian/archive/2011/10/03/sql-server-faq-sql-pourquoi-mon-fichier-de-log-ldf-est-il-aussi-gros-comment-diminuer-sa-taille.aspx

What about the simple recovery mode?

When you perform a SharePoint Backup, SQL is making full backup. That kind of backup do not shrink LDF file, and SharePoint native backup do not handle transaction log. So, if you are only using Sharepoint tools (backup-SPSite/Backup-SPFarm cmdlet or Central Administration) to bakup youre far, you can safely turn youre database to a simple recovery mode. But if you have a more powerful backup solution (such as Microsoft Data Protection Manager) please consider Full recovery mode and en maintenance plan that will periodically perform transaction log backup.

More Info:

Article URL
Checkpoints and the Active Portion of the Log http://msdn.microsoft.com/en-us/library/ms189573.aspx
Plan for backup and recovery (SharePoint Server 2010) http://technet.microsoft.com/en-us/library/cc261687.aspx
SQL Server Recovery Model Overview http://msdn.microsoft.com/en-us/library/ms189275.aspx
Categories: SQL Server