Diary of a SharePoint Consultant

  • Contact

Did you know that Web Platform Installer has an offline mode?

Posted by GillouX on April 24, 2013
Posted in: Tools, Web Platform Installer. Leave a Comment

web-platform-installer-iconWeb Platform becomes more and more the (only?) way to install tools in the world of Microsoft . It acts like a kind of Apple Store, letting you find and install quite easily your favorite apps but to do so you will need to have an Internet connection… or not!

Indeed, in some scenarios, you might not have access to internet, it was at least the case for me. My Dev box is running on the ESX Server of the company and being a server, you do not get internet access. My first thought was no internet, no web platform installer (or like we used to say in french “pas de bras pas de chocolat” but wait, there is a solution…

I was glad to find that Web Platform Installer provides an offline mode and I’ll explain how does it work.

The example will show you how to install the Office Tools for Visual Studio 2012.

1.     Caching

Obviously, this step must be done from a computer that has access to internet.

In order to dump the required installer, I will need to know this ID. You can do that using the following command (you might need execute the command as administrator (Run as Administrator)) to dump the full list into C:\temp\dump.txt.

C:\Program Files\Microsoft\Web Platform Installer>WebPICMD.exe /List /ListOption:All > C:\temp\dump.txt

You will find “OfficeToolsForVS2012RTW” in the listing, this is the one we need. This ID will be used as follow for the caching:

C:\Program Files\Microsoft\Web Platform Installer>WebPICMD.exe /Offline /Products:OfficeToolsForVS2012RTW /Path: \\someShareDrive\WebPlatformInstallerOfflineCache

In this example, I cached the OfficeToolsForVS2012RTW into \\someShareDrive\WebPlatformInstallerOfflineCache

Note that the Path parameter must be a shared drive.

2.     Installing

This step can be done from any computer (with or without access to internet)

To install the required product, run the following command:

C:\Program Files\Microsoft\Web Platform Installer>WebPiCmd.exe /Install /Products: OfficeToolsForVS2012RTW /XML: \\someShareDrive\WebPlatformInstallerOfflineCache\feeds\latest\webproductlist.xml

Hope it helps!

The mistery of RemoveFieldRef

Posted by GillouX on February 5, 2013
Posted in: Sharepoint 2010. 2 comments

What is RemoveFieldRef?

RemoveFieldRef is an element used in a content type definition to remove fields from the parent content type. I find this declarative approach much easier to implement than if you would have done it by code.

You will find here the msdn reference of the RemoveFieldRef element.

How to use it?

We want to create a Content Type which inherits from the Content Type Page but we want to get rid of the fields Contact Picture and Rollup Image.

The followint printscreen illustrates this example.

contentTypeps_empty

To make the example “more real”, I have also added two custom fields CustomCol1 and CustomCol2 just as an example.

What’s the catch?

If you take a closer look at the example, you will see that to make the RemoveFieldRef working, you need:

  1. Use Inherits=”FALSE” in the definition of the content type
  2. You must imperatively use the appropriate case when defining the ID parameter of the RemoveFieldRef, sometimes lower-case, sometimes upper-case

contentTypeps

You will see that PublishingContactPicture ID is in lower-case while PublishingRollupImage ID is in upper-case.

A small trick, SharePoint Manager can be used to find out the proper way of writing the ID.

I usually copy-paste if from the Schema tab.

spm

I hope you will find this useful.

Gilles

Free online Team Foundation Server (TFS)

Posted by GillouX on November 29, 2012
Posted in: TFS. Leave a Comment

If you were living in a cave during the last months, you might have missed the new Team Foundation Service going live!

The good thing about it, it’s FREE
(at least for now)!

Team Foundation Service provides the following features for free:

  • Up to 5 users
  • Unlimited number of projects
  • Version control
  • Work item tracking
  • Agile planning tools
  • Feedback management
  • Build (still in preview)

And yes of course, it works with Visual Studio Team Explorer :)

Look the lovely interface you get

If you are still not convinced, please check out the Features Tour.

Sign Up here

Goodbye VirtualBox, Hello Hyper-V !

Posted by GillouX on November 28, 2012
Posted in: Hyper-V, Sharepoint 2010, SharePoint 2013, VirtualBox, Virtualization. Tagged: sharepoint. 1 comment

Back in Windows 7 I was using Oracle VirtualBox because I needed the 64 bits support to set up SharePoint 2010 virtual machines but now that I run Windows 8, I would rather use Hyper-V!

The goal of this article is to show you that you can get your beloved SharePoint vdi files to run on Windows 8 with Hyper-V with just a little bit of work. I have read a lot of bad stuff about it basically saying that it won’t work properly but I can tell you that it’s nothing to be scared of, I have tested it, you can go ahead with it!

First things first, get Hyper-V installed on Windows 8

Press Windows + X and Click on Programs and Features
Click on Turn Windows features on or off
Select Hyper-V and Click OK and follow the instructions

You will then need to install Oracle Virtual Box on Windows 8 (but do not worry you can delete it later on)

Download and install Virtual Box from here

We will use then Oracle Virtual Box to convert your vdi files into a format compatible with Hyper-V.

I read somewhere that you should uninstall the Guest Tools, I didn’t do it and I got no issues with that.

Using command prompt,
Go in

C:\Program Files\Oracle\Virtual Box (or wherever you have chosen to install Virtual Box)

and Run the following command:

vboxmanage clonehd D:\VMachines\SP2010.vdi D:\VMachines\SP2010.vhd –format VHD

That is it, you can use your vhd as virtual hard drive in a new Hyper-V machine.

Finally, a small trick, get the internet working in your virtual machine through a wireless connection

For those using Hyper-V on a laptop, there is a big chance that you are connected wirelessly. If it is the case, there is a small trick to know in order to get the internet working in the virtual machine (or more generally get the virtual machine to be part of the network), here is how I do it:

Create an Internal Switch in the Virtual Switch Manager of Hyper-V

This action will create a new Virual Adapater.

Create a Bridged Connection between the Wi-Fi and the Internal Switch Virtual Adpater (vEthernet in our example)

Now that everything is set up, you can use the Internal Switch that you created at the first step.

Your Hyper-V machine will be now part of your network as any other physical machine would be.

Hope it helps!

Gilles

Add custom action in Site Actions Menu at a specific location

Posted by GillouX on November 22, 2011
Posted in: Custom Action, Sharepoint 2010. 3 comments

In this article, I am going to show you how to add a new menu item into the Site Actions menu.

In order to do that, you must use a Custom Action.

Here is example of Custom Action:

source : http://msdn.microsoft.com/en-us/library/bb418728%28v=office.12%29.aspx

This Custom Action adds a new item menu called “Hello World Application Page”. When a user clicks on this menu item, he is redirected to a /LitWare/ApplicationPage1.aspx

Something that I would like to point out, is the Sequence property. It’s supposed to allow the developer to choose where he wants to put the menu item. It does make that but only among your custom menu items. So you get to set the order of your menu items, those will be appended at the end of the menu. You can try to set it at 1, it will be still added at the end.

What I am going to show you, it’s to actually work around this limitation and explain how you can actually add a new menu item wherever you want to.

This technique will use two different properties : ControlClass and ControlAssembly

In ControlClass we will define the control which needs to be rendered when the menu item get displayed while ControlAssembly defines the assembly which contains this class.

Check out the following sample:

The Code of the Class, note that the class inherits from WebControl (System.Web)

As you can see, I even didn’t provide any sequence in my Custom Action, the important thing here is the MenuGroupId.

It refers in this case to already existing locations that you can find in the v4.master

By setting a MenuGroupId and a Sequence, you can add your Custom Action within the existing menu and not only at the end.

SharePoint and Acrobat X integration

Posted by GillouX on October 1, 2011
Posted in: PDF, Sharepoint 2010. 31 comments

!<UPDATE>!

A fix for the bug described at the end of this article has been published by Microsoft.

You can find here the related KB.

This is the scenario that refers to our particular issue:

You create a French site collection in SharePoint Foundation 2010.
You upload a .pdf file to a document library in the French site collection.
You check out and edit the file.
You try to check in the file.

It describes the issue with a French site collection but it applies to all non-english site collection.

!<UPDATE>!

In this article, I will show you how to set up the integration SharePoint 2010/Acrobat X.

About Acrobat X

This is not the porn version of Acrobat but the last drop of the Acrobat family made by Adobe.

The great thing with this version is that it comes with an ActiveX which holds a special class to deal with PDF and make the integration nicer and easier.

PDFs and SharePoint

To tell SharePoint and Internet Explorer what they must do when they see a PDF file, you must add a new mapping into the 14/TEMPLATE/XML/DOCICON.XML

but instead of using the old traditional SharePoint.OpenDocuments ActiveX, we will use a brand new feature of the new ActiveX provided by the Acrobat X.

<Mapping Key=”pdf” Value=”pdfIcon.gif”  Text=”Adobe Pro” OpenControl=”AdobeAcrobat.OpenDocuments“/>

Once this is done, you just need to make a small recycle of your Application Pools or a IISRESET.

For every PDF uploaded into a document library, you will have the PDF icon in the type column and a new item “Edit in Adobe Pro” in the ECB (Edit Control Block).

Result

Here is what you get if you have followed me until now. I made my printscreens in French, sorry for that : x

if you click on Modifier dans Acrobat Pro (Edit in Acrobat Pro),  you get the following

Let’s check out the file, modify something and check-in it back.

Common issues

“The URL you have provided could not be reached. Please verify that the URL is correct and that the network location is reachable.”

This one is WebDav related.

1. Check that the client has the WebClient Service enabled in Windows

It should be enabled by default but you never know, especially if you are working in a highly secured environment.

2. Check that the user have the Use Remote Interfaces permission.

“Acrobat cannot access the network”

I came across this issue when doing some working with Acrobat and SharePoint on a French site. Indeed, I did not have this issue on English site.

We got the official word from Microsoft, it’s a bug. They are working on a fix as I speak but they have provided us a workaround in the meantime.

So here it is, let’s the magic happens : you need to recreate 57 fields in English in order to make this working. My guess is that French is not the only buggy version so it should apply to all non-English sites.

Here is the list of fields that you must add to your list.

Content Type ID
Approver Comments
Name
Document Modified By
Document Created By
File Type
HTML File Type
Source URL
Shared File Index
Title
Template Link
HTML File Link
Is Signed
Document ID Value
Document ID
Content Type
Created
Created By
Modified
Modified By
Has Copy Destinations
Copy Source
Approval Status
URL Path
File Size
Item Type
Sort Type
Effective Permissions Mask
ID of the User who has the item Checked Out
Is Checked out to local
Checked Out To
Unique Id
Client Id
Virus Status
Check In Comment
Edit Menu Table Start
Edit Menu Table End
Server Relative URL
Encoded Absolute URL
Property Bag
Level
Is Current Version
Item Child Count
Folder Child Count
Select
Edit
UI Version
Instance ID
Order
Workflow Version
Workflow Instance ID
Source Version (Converted Document)
Source Name (Converted Document)
Document Concurrency Number
Relink
Merge
Path

Here is a script which does that.

Note that each field Hidden property is set to true in order to keep a clean interface.

If none of these fixes have helped you, fire up Fiddler and locate the call to the Copy.asmx, have a look at the HTTP Response, it might reveal some really useful information.

That’s all folks.

Change “Choose Picture” Control in EditProfile.aspx

Posted by GillouX on June 6, 2011
Posted in: Delegate Control, Sharepoint 2010. 5 comments

When editing his profile in SharePoint, a user can (among other things) choose a profile picture.

He clicks Choose Picture and choose a file from his hard-drive disk.

The user experience could be better, maybe we could replace this control by our own?

This is possible using the Delegate Control feature of SharePoint.

I won’t explain what is a Delegate Control because there are already plenty of articles targeting this matter, here for instance.

if you read the article I referenced above, you should have understood by now that a Delegate Control allows you to replace a Control by another but in order to do that, you need to know the ControlId and the Scope

Anywhooo ….

I made myself some digging into the EditProfile.aspx (14/TEMPLATE/LAYOUTS)

You will see that the control responsible for displaying the editing profile section of the page is called ProfileEditor. Using Reflector, I looked ProfileEditor up and realized that it inherits from ProfilUI. If you look at the decompiled code of this abstract class, you will find that the “Choose Picture” Control is in fact a DelegateControl with the following ControlId : MySitePictureEditor and the following Scope : Farm.

Note: ProfilUI is located under the Microsoft.SharePoint.Portal.WebControls namespace in the Microsoft.SharePoint.Portal.dll assembly.

I created a base SharePoint Project which uses the information we have collected above to replace the OOTB MySitePictureEditor, you can download it here.

For demo purpose, I just put a nice I got you!! label.

You can use this project and implement whatever solutions you come up with:

  • a Silverlight Control (webcam photo capture, …)
  • an advanced picture editor allowing the user to resize, crop, …
  • …

If I have time, I’ll look myself to implement one of these solutions.

Hope it helps!

Posts navigation

← Older Entries
  • A Twitter BadgeA Linkedin Badge
    mct
    mcpd
    mcts
  • Twitter

    • Such a domination by Slovakia, it won't be fair to loose 2:0 #iifh #sk #finland 2 weeks ago
    • RT @Herman_NYRBlog: Marian Gaborik apparently failed his end of the year physical and won't play for Slovakia in WC. Was he playing hurt wi… 3 weeks ago
    • "cette épreuve elle est pour moi", essaye de la gagner alors cette fois-ci Naoelle #topchef 1 month ago
    • RT @stevezipay: You're not in minority RT @Tommy_D__: @stevezipay Gaborik +7 in 7 for #CBJ; -8 in 35 games for #NYR. Think Torts misused ... 1 month ago
    • RT @NHLBlackhawks: "Sorry, guys, I really tried to wait." -- Marian Hossa #Blackhawks http://t.co/kJQ6thvrzZ 1 month ago
  • ADO.NET Data Services ASP.NET Audit Client Object Model Code-First Custom Action Delegate Control Document Set Entity Framework FPRPC Hyper-V JQuery Office Search PDF Reflector Sharepoint 2007 Sharepoint 2010 SharePoint 2013 Silverlight TFS Tools Validation VirtualBox Virtualization Web Platform Installer
  • Categories

  • Recent Posts

    • Did you know that Web Platform Installer has an offline mode?
    • The mistery of RemoveFieldRef
    • Free online Team Foundation Server (TFS)
    • Goodbye VirtualBox, Hello Hyper-V !
    • Add custom action in Site Actions Menu at a specific location
  • Blogroll

    • Benjamin Laffont
    • Christopher Clement
    • Maxime Legena's Blog
    • SharePoint – Stack Exchange Q&A
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.com
Blog at WordPress.com. Theme: Parament by Automattic.
Diary of a SharePoint Consultant
Blog at WordPress.com. Theme: Parament.
Follow

Get every new post delivered to your Inbox.

Join 71 other followers

Powered by WordPress.com
Cancel