Pages

Wednesday, December 28, 2011

How to hide properties in Document Information Panel – SharePoint

Document Information Panel – This is the window which shows all the properties associated with the document. Let it be out of the box / default properties (like Title, Keywords), or custom properties or content type properties.

Wait, what are content type properties?
Consider a scenario where you have a SharePoint site and a document library. You create some site columns and then create content type for your document library. (Inheriting from the document content type). Now you associate this newly created content type to your document library and done.

You go ahead and click on create New Document link and Word Editor opens up. Now there you see the Document Information Panel (DIP) containing all the site columns in your content type. These are metadata holders for your document. And that’s why these document properties are called as content type properties.

In Following Image, I have opened the document from the SharePoint document library and added Version and Comments column in the default document content type , which are visible in DIP.


Issue:
There were some of the content type properties which were getting displayed in DIP, but I didn’t want users to see those /change those. In short I needed to hide those.
Let’s try to hide version property from DIP.
Solution:
First thought comes to mind like – ok these properties are nothing but the site columns right? So why don’t we just delete the site columns and get rid of properties in DIP? But NO. Because if we delete the site columns from the content type , the DIP won’t show the property but document will not be holding the metadata for that column.
So what could be done?
Trick I found is, just hide the site column.
How we can do it?
Library settings > Find your content type and click on it > select the site column which you don’t want to see in DIP > click on Hidden option in advanced option and select ok.



Now DIP will not show the content type property when creating new documents from the library
Version column gets hidden from DIP



Note: This approach is used only when the site column is not of type mandatory/required. As per my knowledge you cannot hide the column which is required.


How to debug the word add in project in Visual Studio

Last few days I was playing much with MS word add ins and its development, Yes you are right, when the word ‘develop’ comes into the picture , each and every developer needs to think some logic and then they let the figures do the remaining job. There are many times when run-time error occurs and developer go ahead and track/find them using debugger.
Most of us use Visual Studio, the developer’s heaven as IDE for the .NET based application development and Microsoft has given way too good features to debug your code. (Link here)
Some examples:
·         When debugging web based projects / SharePoint farm solutions , one attaches the debugger to the w3wp.exe (IIS process)
·         When debugging sandboxed solutions one needs to attach the debugger to the SPUCWorkerProcess.exe (SPUC)
·         And again while debugging the timer jobs in SharePoint debugger needs to be attached to Timer service. (OWSTimer.exe)
Ok ok, before I get the question like – come on we know all of these.. I will come to the point directly.
I learnt a lesson that if you need to debug the MS Office Addins then you must attach the debugger to the appropriate MS Office Client.
In my case, as I was working with MS Word Addin – so I needed to attach the debugger to WINWORD.exe service, like this

 
If you do not see WINWORD.exe process , make sure that you have launched the MS Word Client and selected – Show all process , show process from all users/sessions in the attach debugger window.
Also If the debugger is not getting attached, then make sure that the add-in is referring to the dll is latest in the respective location. (For example If add in is referring to the dll somewhere in release folder of your solution then make sure that the dll is latest)